Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_MediaKeyNeededEvent_h__
8 : #define mozilla_dom_MediaKeyNeededEvent_h__
9 :
10 : #include "mozilla/dom/MediaEncryptedEventBinding.h"
11 : #include "mozilla/Attributes.h"
12 : #include "mozilla/ErrorResult.h"
13 : #include "nsCycleCollectionParticipant.h"
14 : #include "nsWrapperCache.h"
15 : #include "nsCOMPtr.h"
16 : #include "mozilla/dom/Event.h"
17 : #include "mozilla/dom/TypedArray.h"
18 : #include "mozilla/Attributes.h"
19 : #include "mozilla/dom/BindingUtils.h"
20 : #include "js/TypeDecls.h"
21 :
22 : namespace mozilla {
23 : namespace dom {
24 :
25 : class MediaEncryptedEvent final : public Event
26 : {
27 : public:
28 : NS_DECL_ISUPPORTS_INHERITED
29 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(MediaEncryptedEvent, Event)
30 : protected:
31 : virtual ~MediaEncryptedEvent();
32 : explicit MediaEncryptedEvent(EventTarget* aOwner);
33 :
34 : nsString mInitDataType;
35 : JS::Heap<JSObject*> mInitData;
36 :
37 : public:
38 :
39 : JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
40 :
41 : static already_AddRefed<MediaEncryptedEvent>
42 : Constructor(EventTarget* aOwner);
43 :
44 : static already_AddRefed<MediaEncryptedEvent>
45 : Constructor(EventTarget* aOwner,
46 : const nsAString& aInitDataType,
47 : const nsTArray<uint8_t>& aInitData);
48 :
49 : static already_AddRefed<MediaEncryptedEvent>
50 : Constructor(const GlobalObject& aGlobal,
51 : const nsAString& aType,
52 : const MediaKeyNeededEventInit& aEventInitDict,
53 : ErrorResult& aRv);
54 :
55 : void GetInitDataType(nsString& aRetVal) const;
56 :
57 : void GetInitData(JSContext* cx,
58 : JS::MutableHandle<JSObject*> aData,
59 : ErrorResult& aRv);
60 : private:
61 : nsTArray<uint8_t> mRawInitData;
62 : };
63 :
64 : } // namespace dom
65 : } // namespace mozilla
66 :
67 : #endif // mozilla_dom_MediaKeyNeededEvent_h__
|