Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1233)

Side by Side Diff: Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h

Issue 1055503002: Eliminate MediaPlayer & MediaPlayerClient abstractions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef HTMLMediaElementEncryptedMedia_h 5 #ifndef HTMLMediaElementEncryptedMedia_h
6 #define HTMLMediaElementEncryptedMedia_h 6 #define HTMLMediaElementEncryptedMedia_h
7 7
8 #include "core/EventTypeNames.h" 8 #include "core/EventTypeNames.h"
9 #include "core/dom/DOMTypedArray.h" 9 #include "core/dom/DOMTypedArray.h"
10 #include "core/events/EventTarget.h" 10 #include "core/events/EventTarget.h"
11 #include "modules/ModulesExport.h" 11 #include "modules/ModulesExport.h"
12 #include "platform/Supplementable.h" 12 #include "platform/Supplementable.h"
13 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
14 #include "public/platform/WebEncryptedMediaTypes.h" 14 #include "public/platform/WebEncryptedMediaTypes.h"
15 #include "public/platform/WebMediaPlayerClient.h" 15 #include "public/platform/WebMediaPlayerEncryptedMediaClient.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class ExceptionState; 19 class ExceptionState;
20 class HTMLMediaElement; 20 class HTMLMediaElement;
21 class MediaKeys; 21 class MediaKeys;
22 class ScriptPromise; 22 class ScriptPromise;
23 class ScriptState; 23 class ScriptState;
24 class WebContentDecryptionModule;
25 class WebMediaPlayer;
24 26
25 class MODULES_EXPORT HTMLMediaElementEncryptedMedia final : public NoBaseWillBeG arbageCollected<HTMLMediaElementEncryptedMedia>, public WillBeHeapSupplement<HTM LMediaElement> { 27 class MODULES_EXPORT HTMLMediaElementEncryptedMedia final : public NoBaseWillBeG arbageCollected<HTMLMediaElementEncryptedMedia>, public WillBeHeapSupplement<HTM LMediaElement>, public WebMediaPlayerEncryptedMediaClient {
26 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElementEncryptedMedia); 28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElementEncryptedMedia);
27 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HTMLMediaElementEncryptedMedia); 29 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HTMLMediaElementEncryptedMedia);
28 public: 30 public:
29 // encrypted media extensions (v0.1b) 31 // encrypted media extensions (v0.1b)
30 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, PassRefPtr<DOMUint8Array> initData, ExceptionState&); 32 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, PassRefPtr<DOMUint8Array> initData, ExceptionState&);
31 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, ExceptionState&); 33 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, ExceptionState&);
32 static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef Ptr<DOMUint8Array> key, PassRefPtr<DOMUint8Array> initData, const String& sessio nId, ExceptionState&); 34 static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef Ptr<DOMUint8Array> key, PassRefPtr<DOMUint8Array> initData, const String& sessio nId, ExceptionState&);
33 static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef Ptr<DOMUint8Array> key, ExceptionState&); 35 static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef Ptr<DOMUint8Array> key, ExceptionState&);
34 static void webkitCancelKeyRequest(HTMLMediaElement&, const String& keySyste m, const String& sessionId, ExceptionState&); 36 static void webkitCancelKeyRequest(HTMLMediaElement&, const String& keySyste m, const String& sessionId, ExceptionState&);
35 37
36 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded); 38 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded);
37 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror); 39 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror);
38 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage); 40 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage);
39 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitneedkey); 41 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitneedkey);
40 42
41 // encrypted media extensions (WD) 43 // encrypted media extensions (WD)
42 static MediaKeys* mediaKeys(HTMLMediaElement&); 44 static MediaKeys* mediaKeys(HTMLMediaElement&);
43 static ScriptPromise setMediaKeys(ScriptState*, HTMLMediaElement&, MediaKeys *); 45 static ScriptPromise setMediaKeys(ScriptState*, HTMLMediaElement&, MediaKeys *);
44 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(encrypted); 46 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(encrypted);
45 47
46 static void keyAdded(HTMLMediaElement&, const String& keySystem, const Strin g& sessionId); 48 // WebMediaPlayerEncryptedMediaClient methods
47 static void keyError(HTMLMediaElement&, const String& keySystem, const Strin g& sessionId, WebMediaPlayerClient::MediaKeyErrorCode, unsigned short systemCode ); 49 void keyAdded(const WebString& keySystem, const WebString& sessionId) final;
48 static void keyMessage(HTMLMediaElement&, const String& keySystem, const Str ing& sessionId, const unsigned char* message, unsigned messageLength, const WebU RL& defaultURL); 50 void keyError(const WebString& keySystem, const WebString& sessionId, WebMed iaPlayerEncryptedMediaClient::MediaKeyErrorCode, unsigned short systemCode) fina l;
49 static void encrypted(HTMLMediaElement&, WebEncryptedMediaInitDataType, cons t unsigned char* initData, unsigned initDataLength); 51 void keyMessage(const WebString& keySystem, const WebString& sessionId, cons t unsigned char* message, unsigned messageLength, const WebURL& defaultURL) fina l;
50 static void didBlockPlaybackWaitingForKey(HTMLMediaElement&); 52 void encrypted(WebEncryptedMediaInitDataType, const unsigned char* initData, unsigned initDataLength) final;
51 static void didResumePlaybackBlockedForKey(HTMLMediaElement&); 53 void didBlockPlaybackWaitingForKey() final;
52 static WebContentDecryptionModule* contentDecryptionModule(HTMLMediaElement& ); 54 void didResumePlaybackBlockedForKey() final;
55 WebContentDecryptionModule* contentDecryptionModule();
53 56
54 static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&); 57 static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&);
55 static const char* supplementName(); 58 static const char* supplementName();
56 59
57 DECLARE_VIRTUAL_TRACE(); 60 DECLARE_VIRTUAL_TRACE();
58 61
59 private: 62 private:
60 friend class SetMediaKeysHandler; 63 friend class SetMediaKeysHandler;
61 64
62 HTMLMediaElementEncryptedMedia(); 65 HTMLMediaElementEncryptedMedia(HTMLMediaElement&);
63 void generateKeyRequest(WebMediaPlayer*, const String& keySystem, PassRefPtr <DOMUint8Array> initData, ExceptionState&); 66 void generateKeyRequest(WebMediaPlayer*, const String& keySystem, PassRefPtr <DOMUint8Array> initData, ExceptionState&);
64 void addKey(WebMediaPlayer*, const String& keySystem, PassRefPtr<DOMUint8Arr ay> key, PassRefPtr<DOMUint8Array> initData, const String& sessionId, ExceptionS tate&); 67 void addKey(WebMediaPlayer*, const String& keySystem, PassRefPtr<DOMUint8Arr ay> key, PassRefPtr<DOMUint8Array> initData, const String& sessionId, ExceptionS tate&);
65 void cancelKeyRequest(WebMediaPlayer*, const String& keySystem, const String & sessionId, ExceptionState&); 68 void cancelKeyRequest(WebMediaPlayer*, const String& keySystem, const String & sessionId, ExceptionState&);
66 69
67 // EventTarget 70 // EventTarget
68 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>); 71 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>);
69 EventListener* getAttributeEventListener(const AtomicString& eventType); 72 EventListener* getAttributeEventListener(const AtomicString& eventType);
70 73
71 // Currently we have both EME v0.1b and EME WD implemented in media element. 74 // Currently we have both EME v0.1b and EME WD implemented in media element.
72 // But we do not want to support both at the same time. The one used first 75 // But we do not want to support both at the same time. The one used first
73 // will be supported. Use |m_emeMode| to track this selection. 76 // will be supported. Use |m_emeMode| to track this selection.
74 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24 9976. 77 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24 9976.
75 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed }; 78 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed };
76 79
77 // check (and set if necessary) the encrypted media extensions (EME) mode 80 // check (and set if necessary) the encrypted media extensions (EME) mode
78 // (v0.1b or WD). Returns whether the mode is allowed and successfully set. 81 // (v0.1b or WD). Returns whether the mode is allowed and successfully set.
79 bool setEmeMode(EmeMode); 82 bool setEmeMode(EmeMode);
80 83
81 WebContentDecryptionModule* contentDecryptionModule(); 84 HTMLMediaElement& m_mediaElement;
82
83 EmeMode m_emeMode; 85 EmeMode m_emeMode;
84 86
85 bool m_isWaitingForKey; 87 bool m_isWaitingForKey;
86 88
87 PersistentWillBeMember<MediaKeys> m_mediaKeys; 89 PersistentWillBeMember<MediaKeys> m_mediaKeys;
88 }; 90 };
89 91
90 } // namespace blink 92 } // namespace blink
91 93
92 #endif 94 #endif
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoaderClient.h ('k') | Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698