2010-08-25 13:10:00 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-08-25 13:10:00 +00:00
|
|
|
|
|
|
|
#ifndef nsDOMNotifyAudioAvailableEvent_h_
|
|
|
|
#define nsDOMNotifyAudioAvailableEvent_h_
|
|
|
|
|
|
|
|
#include "nsIDOMNotifyAudioAvailableEvent.h"
|
|
|
|
#include "nsDOMEvent.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2013-05-02 17:11:12 +00:00
|
|
|
#include "mozilla/dom/NotifyAudioAvailableEventBinding.h"
|
2010-08-25 13:10:00 +00:00
|
|
|
|
2013-08-29 21:18:25 +00:00
|
|
|
class nsPresContext;
|
|
|
|
|
2010-08-25 13:10:00 +00:00
|
|
|
class nsDOMNotifyAudioAvailableEvent : public nsDOMEvent,
|
|
|
|
public nsIDOMNotifyAudioAvailableEvent
|
|
|
|
{
|
|
|
|
public:
|
2013-03-09 11:34:29 +00:00
|
|
|
nsDOMNotifyAudioAvailableEvent(mozilla::dom::EventTarget* aOwner,
|
2013-10-02 03:46:04 +00:00
|
|
|
nsPresContext* aPresContext,
|
|
|
|
mozilla::WidgetEvent* aEvent,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aEventType, float * aFrameBuffer,
|
|
|
|
uint32_t aFrameBufferLength, float aTime);
|
2010-08-25 13:10:00 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsDOMNotifyAudioAvailableEvent,
|
|
|
|
nsDOMEvent)
|
|
|
|
|
|
|
|
NS_DECL_NSIDOMNOTIFYAUDIOAVAILABLEEVENT
|
|
|
|
NS_FORWARD_NSIDOMEVENT(nsDOMEvent::)
|
|
|
|
|
|
|
|
nsresult NS_NewDOMAudioAvailableEvent(nsIDOMEvent** aInstancePtrResult,
|
2013-03-09 11:34:29 +00:00
|
|
|
mozilla::dom::EventTarget* aOwner,
|
2010-08-25 13:10:00 +00:00
|
|
|
nsPresContext* aPresContext,
|
2013-10-02 03:46:04 +00:00
|
|
|
mozilla::WidgetEvent* aEvent,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aEventType,
|
2010-08-25 13:10:00 +00:00
|
|
|
float * aFrameBuffer,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aFrameBufferLength,
|
2010-08-25 13:10:00 +00:00
|
|
|
float aTime);
|
|
|
|
|
|
|
|
~nsDOMNotifyAudioAvailableEvent();
|
|
|
|
|
2013-05-02 17:11:12 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
return mozilla::dom::NotifyAudioAvailableEventBinding::Wrap(aCx, aScope, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
JSObject* GetFrameBuffer(JSContext* aCx, mozilla::ErrorResult& aRv)
|
|
|
|
{
|
2013-05-30 21:46:48 +00:00
|
|
|
JS::Rooted<JS::Value> dummy(aCx);
|
2014-01-09 17:39:36 +00:00
|
|
|
aRv = GetFrameBuffer(aCx, &dummy);
|
2013-05-02 17:11:12 +00:00
|
|
|
return mCachedArray;
|
|
|
|
}
|
|
|
|
|
|
|
|
float Time()
|
|
|
|
{
|
|
|
|
return mTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitAudioAvailableEvent(const nsAString& aType,
|
|
|
|
bool aCanBubble,
|
|
|
|
bool aCancelable,
|
|
|
|
const mozilla::dom::Nullable<mozilla::dom::Sequence<float> >& aFrameBuffer,
|
|
|
|
uint32_t aFrameBufferLength,
|
|
|
|
float aTime,
|
|
|
|
bool aAllowAudioData,
|
|
|
|
mozilla::ErrorResult& aRv);
|
2010-08-25 13:10:00 +00:00
|
|
|
private:
|
|
|
|
nsAutoArrayPtr<float> mFrameBuffer;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mFrameBufferLength;
|
2010-08-25 13:10:00 +00:00
|
|
|
float mTime;
|
2013-06-18 10:00:38 +00:00
|
|
|
JS::Heap<JSObject*> mCachedArray;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mAllowAudioData;
|
2010-08-25 13:10:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsDOMNotifyAudioAvailableEvent_h_
|