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" |
(...skipping 22 matching lines...) Expand all Loading... |
33 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror); | 33 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror); |
34 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage); | 34 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage); |
35 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitneedkey); | 35 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitneedkey); |
36 | 36 |
37 // encrypted media extensions (WD) | 37 // encrypted media extensions (WD) |
38 static MediaKeys* mediaKeys(HTMLMediaElement&); | 38 static MediaKeys* mediaKeys(HTMLMediaElement&); |
39 static void setMediaKeys(HTMLMediaElement&, MediaKeys*, ExceptionState&); | 39 static void setMediaKeys(HTMLMediaElement&, MediaKeys*, ExceptionState&); |
40 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(needkey); | 40 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(needkey); |
41 | 41 |
42 static void keyAdded(HTMLMediaElement&, const String& keySystem, const Strin
g& sessionId); | 42 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); | 43 static void keyError(HTMLMediaElement&, const String& keySystem, const Strin
g& sessionId, WebMediaPlayerClient::MediaKeyErrorCode, unsigned short systemCode
); |
44 static void keyMessage(HTMLMediaElement&, const String& keySystem, const Str
ing& sessionId, const unsigned char* message, unsigned messageLength, const blin
k::WebURL& defaultURL); | 44 static void keyMessage(HTMLMediaElement&, const String& keySystem, const Str
ing& sessionId, const unsigned char* message, unsigned messageLength, const WebU
RL& defaultURL); |
45 static void keyNeeded(HTMLMediaElement&, const String& contentType, const un
signed char* initData, unsigned initDataLength); | 45 static void keyNeeded(HTMLMediaElement&, const String& contentType, const un
signed char* initData, unsigned initDataLength); |
46 static void playerDestroyed(HTMLMediaElement&); | 46 static void playerDestroyed(HTMLMediaElement&); |
47 static blink::WebContentDecryptionModule* contentDecryptionModule(HTMLMediaE
lement&); | 47 static WebContentDecryptionModule* contentDecryptionModule(HTMLMediaElement&
); |
48 | 48 |
49 static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&); | 49 static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&); |
50 static const char* supplementName(); | 50 static const char* supplementName(); |
51 | 51 |
52 virtual void trace(Visitor*) OVERRIDE; | 52 virtual void trace(Visitor*) OVERRIDE; |
53 | 53 |
54 private: | 54 private: |
55 HTMLMediaElementEncryptedMedia(); | 55 HTMLMediaElementEncryptedMedia(); |
56 void generateKeyRequest(blink::WebMediaPlayer*, const String& keySystem, Pas
sRefPtr<Uint8Array> initData, ExceptionState&); | 56 void generateKeyRequest(WebMediaPlayer*, const String& keySystem, PassRefPtr
<Uint8Array> initData, ExceptionState&); |
57 void addKey(blink::WebMediaPlayer*, const String& keySystem, PassRefPtr<Uint
8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, Exception
State&); | 57 void addKey(WebMediaPlayer*, const String& keySystem, PassRefPtr<Uint8Array>
key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionState&)
; |
58 void cancelKeyRequest(blink::WebMediaPlayer*, const String& keySystem, const
String& sessionId, ExceptionState&); | 58 void cancelKeyRequest(WebMediaPlayer*, const String& keySystem, const String
& sessionId, ExceptionState&); |
59 | 59 |
60 // EventTarget | 60 // EventTarget |
61 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve
ntListener>); | 61 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve
ntListener>); |
62 EventListener* getAttributeEventListener(const AtomicString& eventType); | 62 EventListener* getAttributeEventListener(const AtomicString& eventType); |
63 | 63 |
64 // Currently we have both EME v0.1b and EME WD implemented in media element. | 64 // 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 | 65 // 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. | 66 // 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. | 67 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24
9976. |
68 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed }; | 68 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed }; |
69 | 69 |
70 // check (and set if necessary) the encrypted media extensions (EME) mode | 70 // 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. | 71 // (v0.1b or WD). Returns whether the mode is allowed and successfully set. |
72 bool setEmeMode(EmeMode, ExceptionState&); | 72 bool setEmeMode(EmeMode, ExceptionState&); |
73 | 73 |
74 blink::WebContentDecryptionModule* contentDecryptionModule(); | 74 WebContentDecryptionModule* contentDecryptionModule(); |
75 void setMediaKeysInternal(HTMLMediaElement&, MediaKeys*); | 75 void setMediaKeysInternal(HTMLMediaElement&, MediaKeys*); |
76 | 76 |
77 EmeMode m_emeMode; | 77 EmeMode m_emeMode; |
78 | 78 |
79 PersistentWillBeMember<MediaKeys> m_mediaKeys; | 79 PersistentWillBeMember<MediaKeys> m_mediaKeys; |
80 }; | 80 }; |
81 | 81 |
82 } | 82 } // namespace blink |
83 | 83 |
84 #endif | 84 #endif |
OLD | NEW |