Chromium Code Reviews| Index: Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h |
| diff --git a/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h b/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b137a327062ada5c31df31862ae905a1f4e19799 |
| --- /dev/null |
| +++ b/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h |
| @@ -0,0 +1,87 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef HTMLMediaElementEncryptedMedia_h |
| +#define HTMLMediaElementEncryptedMedia_h |
| + |
| +#include "core/events/EventTarget.h" |
| +#include "heap/Handle.h" |
| +#include "platform/Supplementable.h" |
| +#include "platform/graphics/media/MediaPlayer.h" |
| +#include "public/platform/WebMediaPlayerClient.h" |
| +#include "wtf/Forward.h" |
| + |
| +typedef blink::WebMediaPlayerClient::MediaKeyErrorCode MediaKeyErrorCode; |
|
acolwell GONE FROM CHROMIUM
2014/02/26 17:19:19
nit: I don't think this should be here. Nothing in
|
| + |
| +namespace WebCore { |
| + |
| +class ExceptionState; |
| +class HTMLMediaElement; |
| +class MediaKeys; |
| + |
| +class HTMLMediaElementEncryptedMedia : public Supplement<HTMLMediaElement> { |
| +public: |
| + // encrypted media extensions (v0.1b) |
| + static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionState&); |
| + static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySystem, ExceptionState&); |
| + static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionState&); |
| + static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRefPtr<Uint8Array> key, ExceptionState&); |
| + static void webkitCancelKeyRequest(HTMLMediaElement&, const String& keySystem, const String& sessionId, ExceptionState&); |
| + |
| + DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded); |
| + DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror); |
| + DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage); |
| + DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitneedkey); |
| + |
| + // encrypted media extensions (WD) |
| + static MediaKeys* mediaKeys(HTMLMediaElement&); |
| + static void setMediaKeys(HTMLMediaElement&, MediaKeys*, ExceptionState&); |
| + DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(needkey); |
| + |
| + static void keyAdded(HTMLMediaElement&, const blink::WebString& keySystem, const blink::WebString& sessionId); |
|
acolwell GONE FROM CHROMIUM
2014/02/26 17:19:19
nit: I think you should change the blink::WebStrin
|
| + static void keyError(HTMLMediaElement&, const blink::WebString& keySystem, const blink::WebString& sessionId, MediaKeyErrorCode, unsigned short systemCode); |
| + static void keyMessage(HTMLMediaElement&, const blink::WebString& keySystem, const blink::WebString& sessionId, const unsigned char* message, unsigned messageLength, const blink::WebURL& defaultURL); |
| + static void keyNeeded(HTMLMediaElement&, const blink::WebString& contentType, const unsigned char* initData, unsigned initDataLength); |
| + static void playerDestroyed(HTMLMediaElement&); |
| + static blink::WebContentDecryptionModule* contentDecryptionModule(HTMLMediaElement&); |
| + |
| + virtual ~HTMLMediaElementEncryptedMedia(); |
| + static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&); |
| + static const char* supplementName(); |
| + |
| +private: |
| + HTMLMediaElementEncryptedMedia(HTMLMediaElement&); |
| + void generateKeyRequest(const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionState&); |
| + void addKey(const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionState&); |
| + void cancelKeyRequest(const String& keySystem, const String& sessionId, ExceptionState&); |
| + |
| + // EventTarget |
| + bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>); |
| + EventListener* getAttributeEventListener(const AtomicString& eventType); |
| + |
| + // Currently we have both EME v0.1b and EME WD implemented in media element. |
| + // But we do not want to support both at the same time. The one used first |
| + // will be supported. Use |m_emeMode| to track this selection. |
| + // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/249976. |
| + enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed }; |
| + |
| + // check (and set if necessary) the encrypted media extensions (EME) mode |
| + // (v0.1b or WD). Returns whether the mode is allowed and successfully set. |
| + bool setEmeMode(EmeMode, ExceptionState&); |
| + |
| + blink::WebContentDecryptionModule* contentDecryptionModule(); |
| + void setMediaKeysInternal(MediaKeys*); |
| + |
| + MediaPlayer* player(); |
|
acolwell GONE FROM CHROMIUM
2014/02/26 17:19:19
nit: Remove. It doesn't look like this is used/def
|
| + blink::WebMediaPlayer* webMediaPlayer(); |
| + |
| + EmeMode m_emeMode; |
| + |
| + RefPtrWillBePersistent<MediaKeys> m_mediaKeys; |
| + HTMLMediaElement& m_mediaElement; |
| +}; |
| + |
| +} |
| + |
| +#endif |