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_MediaKeyMessageEvent_h__
8 : #define mozilla_dom_MediaKeyMessageEvent_h__
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "mozilla/ErrorResult.h"
12 : #include "nsCycleCollectionParticipant.h"
13 : #include "nsWrapperCache.h"
14 : #include "nsCOMPtr.h"
15 : #include "mozilla/dom/Event.h"
16 : #include "mozilla/dom/TypedArray.h"
17 : #include "js/TypeDecls.h"
18 : #include "mozilla/dom/MediaKeyMessageEventBinding.h"
19 :
20 : namespace mozilla {
21 : namespace dom {
22 :
23 : struct MediaKeyMessageEventInit;
24 :
25 : class MediaKeyMessageEvent final : public Event
26 : {
27 : public:
28 : NS_DECL_ISUPPORTS_INHERITED
29 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(MediaKeyMessageEvent, Event)
30 : protected:
31 : virtual ~MediaKeyMessageEvent();
32 : explicit MediaKeyMessageEvent(EventTarget* aOwner);
33 :
34 : MediaKeyMessageType mMessageType;
35 : JS::Heap<JSObject*> mMessage;
36 :
37 : public:
38 : virtual MediaKeyMessageEvent* AsMediaKeyMessageEvent();
39 :
40 : JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
41 :
42 : static already_AddRefed<MediaKeyMessageEvent>
43 : Constructor(EventTarget* aOwner,
44 : MediaKeyMessageType aMessageType,
45 : const nsTArray<uint8_t>& aMessage);
46 :
47 : static already_AddRefed<MediaKeyMessageEvent>
48 : Constructor(const GlobalObject& aGlobal,
49 : const nsAString& aType,
50 : const MediaKeyMessageEventInit& aEventInitDict,
51 : ErrorResult& aRv);
52 :
53 0 : MediaKeyMessageType MessageType() const { return mMessageType; }
54 :
55 : void GetMessage(JSContext* cx,
56 : JS::MutableHandle<JSObject*> aMessage,
57 : ErrorResult& aRv);
58 :
59 : private:
60 : nsTArray<uint8_t> mRawMessage;
61 : };
62 :
63 :
64 : } // namespace dom
65 : } // namespace mozilla
66 :
67 : #endif // mozilla_dom_MediaKeyMessageEvent_h__
|