Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "modules/EventTargetModules.h" | 8 #include "modules/EventTargetModules.h" |
| 9 #include "platform/Supplementable.h" | 9 #include "platform/Supplementable.h" |
| 10 #include "platform/graphics/media/MediaPlayer.h" | 10 #include "platform/graphics/media/MediaPlayer.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "public/platform/WebMediaPlayerClient.h" | 12 #include "public/platform/WebMediaPlayerClient.h" |
| 13 #include "wtf/Forward.h" | 13 #include "wtf/Forward.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class ExceptionState; | 17 class ExceptionState; |
| 18 class HTMLMediaElement; | 18 class HTMLMediaElement; |
| 19 class MediaKeys; | 19 class MediaKeys; |
| 20 class ScriptPromise; | |
| 21 class ScriptState; | |
| 20 | 22 |
| 21 class HTMLMediaElementEncryptedMedia FINAL : public NoBaseWillBeGarbageCollected <HTMLMediaElementEncryptedMedia>, public WillBeHeapSupplement<HTMLMediaElement> { | 23 class HTMLMediaElementEncryptedMedia FINAL : public NoBaseWillBeGarbageCollected <HTMLMediaElementEncryptedMedia>, public WillBeHeapSupplement<HTMLMediaElement> { |
| 22 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElementEncryptedMedia); | 24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElementEncryptedMedia); |
| 23 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(HTMLMediaElementEncryptedMe dia); | 25 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(HTMLMediaElementEncryptedMe dia); |
| 24 public: | 26 public: |
| 25 // encrypted media extensions (v0.1b) | 27 // encrypted media extensions (v0.1b) |
| 26 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, PassRefPtr<Uint8Array> initData, ExceptionState&); | 28 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, PassRefPtr<Uint8Array> initData, ExceptionState&); |
| 27 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, ExceptionState&); | 29 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, ExceptionState&); |
| 28 static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef Ptr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, E xceptionState&); | 30 static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef Ptr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, E xceptionState&); |
| 29 static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef Ptr<Uint8Array> key, ExceptionState&); | 31 static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef Ptr<Uint8Array> key, ExceptionState&); |
| 30 static void webkitCancelKeyRequest(HTMLMediaElement&, const String& keySyste m, const String& sessionId, ExceptionState&); | 32 static void webkitCancelKeyRequest(HTMLMediaElement&, const String& keySyste m, const String& sessionId, ExceptionState&); |
| 31 | 33 |
| 32 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded); | 34 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded); |
| 33 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror); | 35 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror); |
| 34 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage); | 36 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage); |
| 35 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitneedkey); | 37 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitneedkey); |
| 36 | 38 |
| 37 // encrypted media extensions (WD) | 39 // encrypted media extensions (WD) |
| 38 static MediaKeys* mediaKeys(HTMLMediaElement&); | 40 static MediaKeys* mediaKeys(HTMLMediaElement&); |
| 39 static void setMediaKeys(HTMLMediaElement&, MediaKeys*, ExceptionState&); | 41 static ScriptPromise setMediaKeys(ScriptState*, HTMLMediaElement&, MediaKeys *); |
| 40 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(needkey); | 42 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(needkey); |
| 41 | 43 |
| 42 static void keyAdded(HTMLMediaElement&, const String& keySystem, const Strin g& sessionId); | 44 static void keyAdded(HTMLMediaElement&, const String& keySystem, const Strin g& sessionId); |
| 43 static void keyError(HTMLMediaElement&, const String& keySystem, const Strin g& sessionId, blink::WebMediaPlayerClient::MediaKeyErrorCode, unsigned short sys temCode); | 45 static void keyError(HTMLMediaElement&, const String& keySystem, const Strin g& sessionId, blink::WebMediaPlayerClient::MediaKeyErrorCode, unsigned short sys temCode); |
| 44 static void keyMessage(HTMLMediaElement&, const String& keySystem, const Str ing& sessionId, const unsigned char* message, unsigned messageLength, const blin k::WebURL& defaultURL); | 46 static void keyMessage(HTMLMediaElement&, const String& keySystem, const Str ing& sessionId, const unsigned char* message, unsigned messageLength, const blin k::WebURL& defaultURL); |
| 45 static void keyNeeded(HTMLMediaElement&, const String& contentType, const un signed char* initData, unsigned initDataLength); | 47 static void keyNeeded(HTMLMediaElement&, const String& contentType, const un signed char* initData, unsigned initDataLength); |
| 46 static void playerDestroyed(HTMLMediaElement&); | 48 static void playerDestroyed(HTMLMediaElement&); |
| 47 static blink::WebContentDecryptionModule* contentDecryptionModule(HTMLMediaE lement&); | 49 static blink::WebContentDecryptionModule* contentDecryptionModule(HTMLMediaE lement&); |
| 48 | 50 |
| 49 static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&); | 51 static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&); |
| 50 static const char* supplementName(); | 52 static const char* supplementName(); |
| 51 | 53 |
| 52 virtual void trace(Visitor*) OVERRIDE; | 54 virtual void trace(Visitor*) OVERRIDE; |
| 53 | 55 |
| 54 private: | 56 private: |
| 57 friend class SetMediaKeysWorker; | |
|
ddorwin
2014/07/31 00:56:36
"Worker" has specific JS-facing meanings. Is there
jrummell
2014/08/07 01:43:02
Looked like "Implementer" and "Handler" are common
| |
| 58 | |
| 55 HTMLMediaElementEncryptedMedia(); | 59 HTMLMediaElementEncryptedMedia(); |
| 56 void generateKeyRequest(blink::WebMediaPlayer*, const String& keySystem, Pas sRefPtr<Uint8Array> initData, ExceptionState&); | 60 void generateKeyRequest(blink::WebMediaPlayer*, const String& keySystem, Pas sRefPtr<Uint8Array> initData, ExceptionState&); |
| 57 void addKey(blink::WebMediaPlayer*, const String& keySystem, PassRefPtr<Uint 8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, Exception State&); | 61 void addKey(blink::WebMediaPlayer*, const String& keySystem, PassRefPtr<Uint 8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, Exception State&); |
| 58 void cancelKeyRequest(blink::WebMediaPlayer*, const String& keySystem, const String& sessionId, ExceptionState&); | 62 void cancelKeyRequest(blink::WebMediaPlayer*, const String& keySystem, const String& sessionId, ExceptionState&); |
| 59 | 63 |
| 60 // EventTarget | 64 // EventTarget |
| 61 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>); | 65 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>); |
| 62 EventListener* getAttributeEventListener(const AtomicString& eventType); | 66 EventListener* getAttributeEventListener(const AtomicString& eventType); |
| 63 | 67 |
| 64 // Currently we have both EME v0.1b and EME WD implemented in media element. | 68 // Currently we have both EME v0.1b and EME WD implemented in media element. |
| 65 // But we do not want to support both at the same time. The one used first | 69 // But we do not want to support both at the same time. The one used first |
| 66 // will be supported. Use |m_emeMode| to track this selection. | 70 // will be supported. Use |m_emeMode| to track this selection. |
| 67 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24 9976. | 71 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24 9976. |
| 68 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed }; | 72 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed }; |
| 69 | 73 |
| 70 // check (and set if necessary) the encrypted media extensions (EME) mode | 74 // check (and set if necessary) the encrypted media extensions (EME) mode |
| 71 // (v0.1b or WD). Returns whether the mode is allowed and successfully set. | 75 // (v0.1b or WD). Returns whether the mode is allowed and successfully set. |
| 72 bool setEmeMode(EmeMode, ExceptionState&); | 76 bool setEmeMode(EmeMode); |
| 73 | 77 |
| 74 blink::WebContentDecryptionModule* contentDecryptionModule(); | 78 blink::WebContentDecryptionModule* contentDecryptionModule(); |
| 75 void setMediaKeysInternal(HTMLMediaElement&, MediaKeys*); | |
| 76 | 79 |
| 77 EmeMode m_emeMode; | 80 EmeMode m_emeMode; |
| 78 | 81 |
| 79 PersistentWillBeMember<MediaKeys> m_mediaKeys; | 82 PersistentWillBeMember<MediaKeys> m_mediaKeys; |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 } | 85 } |
| 83 | 86 |
| 84 #endif | 87 #endif |
| OLD | NEW |