| 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 "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" | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 21 class MediaKeys; | 21 class MediaKeys; | 
| 22 class ScriptPromise; | 22 class ScriptPromise; | 
| 23 class ScriptState; | 23 class ScriptState; | 
| 24 class WebContentDecryptionModule; | 24 class WebContentDecryptionModule; | 
| 25 class WebMediaPlayer; | 25 class WebMediaPlayer; | 
| 26 | 26 | 
| 27 class MODULES_EXPORT HTMLMediaElementEncryptedMedia final : public NoBaseWillBeG
    arbageCollectedFinalized<HTMLMediaElementEncryptedMedia>, public WillBeHeapSuppl
    ement<HTMLMediaElement>, public WebMediaPlayerEncryptedMediaClient { | 27 class MODULES_EXPORT HTMLMediaElementEncryptedMedia final : public NoBaseWillBeG
    arbageCollectedFinalized<HTMLMediaElementEncryptedMedia>, public WillBeHeapSuppl
    ement<HTMLMediaElement>, public WebMediaPlayerEncryptedMediaClient { | 
| 28     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElementEncryptedMedia); | 28     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElementEncryptedMedia); | 
| 29     USING_FAST_MALLOC_WILL_BE_REMOVED(HTMLMediaElementEncryptedMedia); | 29     USING_FAST_MALLOC_WILL_BE_REMOVED(HTMLMediaElementEncryptedMedia); | 
| 30 public: | 30 public: | 
| 31     // encrypted media extensions (v0.1b) |  | 
| 32     static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys
    tem, PassRefPtr<DOMUint8Array> initData, ExceptionState&); |  | 
| 33     static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys
    tem, ExceptionState&); |  | 
| 34     static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef
    Ptr<DOMUint8Array> key, PassRefPtr<DOMUint8Array> initData, const String& sessio
    nId, ExceptionState&); |  | 
| 35     static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef
    Ptr<DOMUint8Array> key, ExceptionState&); |  | 
| 36     static void webkitCancelKeyRequest(HTMLMediaElement&, const String& keySyste
    m, const String& sessionId, ExceptionState&); |  | 
| 37 |  | 
| 38     DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded); |  | 
| 39     DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror); |  | 
| 40     DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage); |  | 
| 41     DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitneedkey); |  | 
| 42 |  | 
| 43     // encrypted media extensions (WD) |  | 
| 44     static MediaKeys* mediaKeys(HTMLMediaElement&); | 31     static MediaKeys* mediaKeys(HTMLMediaElement&); | 
| 45     static ScriptPromise setMediaKeys(ScriptState*, HTMLMediaElement&, MediaKeys
    *); | 32     static ScriptPromise setMediaKeys(ScriptState*, HTMLMediaElement&, MediaKeys
    *); | 
| 46     DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(encrypted); | 33     DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(encrypted); | 
| 47 | 34 | 
| 48     // WebMediaPlayerEncryptedMediaClient methods | 35     // WebMediaPlayerEncryptedMediaClient methods | 
| 49     void keyAdded(const WebString& keySystem, const WebString& sessionId) final; |  | 
| 50     void keyError(const WebString& keySystem, const WebString& sessionId, WebMed
    iaPlayerEncryptedMediaClient::MediaKeyErrorCode, unsigned short systemCode) fina
    l; |  | 
| 51     void keyMessage(const WebString& keySystem, const WebString& sessionId, cons
    t unsigned char* message, unsigned messageLength, const WebURL& defaultURL) fina
    l; |  | 
| 52     void encrypted(WebEncryptedMediaInitDataType, const unsigned char* initData,
     unsigned initDataLength) final; | 36     void encrypted(WebEncryptedMediaInitDataType, const unsigned char* initData,
     unsigned initDataLength) final; | 
| 53     void didBlockPlaybackWaitingForKey() final; | 37     void didBlockPlaybackWaitingForKey() final; | 
| 54     void didResumePlaybackBlockedForKey() final; | 38     void didResumePlaybackBlockedForKey() final; | 
| 55     WebContentDecryptionModule* contentDecryptionModule(); | 39     WebContentDecryptionModule* contentDecryptionModule(); | 
| 56 | 40 | 
| 57     static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&); | 41     static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&); | 
| 58     static const char* supplementName(); | 42     static const char* supplementName(); | 
| 59 | 43 | 
| 60     ~HTMLMediaElementEncryptedMedia(); | 44     ~HTMLMediaElementEncryptedMedia(); | 
| 61 | 45 | 
| 62     DECLARE_VIRTUAL_TRACE(); | 46     DECLARE_VIRTUAL_TRACE(); | 
| 63 | 47 | 
| 64 private: | 48 private: | 
| 65     friend class SetMediaKeysHandler; | 49     friend class SetMediaKeysHandler; | 
| 66 | 50 | 
| 67     HTMLMediaElementEncryptedMedia(HTMLMediaElement&); | 51     HTMLMediaElementEncryptedMedia(HTMLMediaElement&); | 
| 68     void generateKeyRequest(WebMediaPlayer*, const String& keySystem, PassRefPtr
    <DOMUint8Array> initData, ExceptionState&); |  | 
| 69     void addKey(WebMediaPlayer*, const String& keySystem, PassRefPtr<DOMUint8Arr
    ay> key, PassRefPtr<DOMUint8Array> initData, const String& sessionId, ExceptionS
    tate&); |  | 
| 70     void cancelKeyRequest(WebMediaPlayer*, const String& keySystem, const String
    & sessionId, ExceptionState&); |  | 
| 71 | 52 | 
| 72     // EventTarget | 53     // EventTarget | 
| 73     bool setAttributeEventListener(const AtomicString& eventType, PassRefPtrWill
    BeRawPtr<EventListener>); | 54     bool setAttributeEventListener(const AtomicString& eventType, PassRefPtrWill
    BeRawPtr<EventListener>); | 
| 74     EventListener* getAttributeEventListener(const AtomicString& eventType); | 55     EventListener* getAttributeEventListener(const AtomicString& eventType); | 
| 75 | 56 | 
| 76     // Currently we have both EME v0.1b and EME WD implemented in media element. |  | 
| 77     // But we do not want to support both at the same time. The one used first |  | 
| 78     // will be supported. Use |m_emeMode| to track this selection. |  | 
| 79     // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24
    9976. |  | 
| 80     enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed }; |  | 
| 81 |  | 
| 82     // check (and set if necessary) the encrypted media extensions (EME) mode |  | 
| 83     // (v0.1b or WD). Returns whether the mode is allowed and successfully set. |  | 
| 84     bool setEmeMode(EmeMode); |  | 
| 85 |  | 
| 86     RawPtrWillBeMember<HTMLMediaElement> m_mediaElement; | 57     RawPtrWillBeMember<HTMLMediaElement> m_mediaElement; | 
| 87     EmeMode m_emeMode; |  | 
| 88 | 58 | 
| 89     bool m_isWaitingForKey; | 59     bool m_isWaitingForKey; | 
| 90 | 60 | 
| 91     PersistentWillBeMember<MediaKeys> m_mediaKeys; | 61     PersistentWillBeMember<MediaKeys> m_mediaKeys; | 
| 92 }; | 62 }; | 
| 93 | 63 | 
| 94 } // namespace blink | 64 } // namespace blink | 
| 95 | 65 | 
| 96 #endif | 66 #endif | 
| OLD | NEW | 
|---|