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

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

Issue 157423003: Remove the dependency on encryptedmedia from HTMLMediaElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move EME completely from core::HTMLMediaElement to modules::HTMLMediaElementEncryptedMedia (Based o… Created 6 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef HTMLMediaElementEncryptedMedia_h
6 #define HTMLMediaElementEncryptedMedia_h
7
8 #include "core/events/EventTarget.h"
9 #include "heap/Handle.h"
10 #include "platform/Supplementable.h"
11 #include "platform/graphics/media/MediaPlayer.h"
12 #include "public/platform/WebMediaPlayerClient.h"
13 #include "wtf/Forward.h"
14
15 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
16
17 namespace WebCore {
18
19 class ExceptionState;
20 class HTMLMediaElement;
21 class MediaKeys;
22
23 class HTMLMediaElementEncryptedMedia : public Supplement<HTMLMediaElement> {
24 public:
25 // encrypted media extensions (v0.1b)
26 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, PassRefPtr<Uint8Array> initData, ExceptionState&);
27 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&);
29 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&);
31
32 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded);
33 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror);
34 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage);
35 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitneedkey);
36
37 // encrypted media extensions (WD)
38 static MediaKeys* mediaKeys(HTMLMediaElement&);
39 static void setMediaKeys(HTMLMediaElement&, MediaKeys*, ExceptionState&);
40 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(needkey);
41
42 static void keyAdded(HTMLMediaElement&, const blink::WebString& keySystem, c onst blink::WebString& sessionId);
acolwell GONE FROM CHROMIUM 2014/02/26 17:19:19 nit: I think you should change the blink::WebStrin
43 static void keyError(HTMLMediaElement&, const blink::WebString& keySystem, c onst blink::WebString& sessionId, MediaKeyErrorCode, unsigned short systemCode);
44 static void keyMessage(HTMLMediaElement&, const blink::WebString& keySystem, const blink::WebString& sessionId, const unsigned char* message, unsigned messa geLength, const blink::WebURL& defaultURL);
45 static void keyNeeded(HTMLMediaElement&, const blink::WebString& contentType , const unsigned char* initData, unsigned initDataLength);
46 static void playerDestroyed(HTMLMediaElement&);
47 static blink::WebContentDecryptionModule* contentDecryptionModule(HTMLMediaE lement&);
48
49 virtual ~HTMLMediaElementEncryptedMedia();
50 static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&);
51 static const char* supplementName();
52
53 private:
54 HTMLMediaElementEncryptedMedia(HTMLMediaElement&);
55 void generateKeyRequest(const String& keySystem, PassRefPtr<Uint8Array> init Data, ExceptionState&);
56 void addKey(const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr< Uint8Array> initData, const String& sessionId, ExceptionState&);
57 void cancelKeyRequest(const String& keySystem, const String& sessionId, Exce ptionState&);
58
59 // EventTarget
60 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>);
61 EventListener* getAttributeEventListener(const AtomicString& eventType);
62
63 // Currently we have both EME v0.1b and EME WD implemented in media element.
64 // But we do not want to support both at the same time. The one used first
65 // will be supported. Use |m_emeMode| to track this selection.
66 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24 9976.
67 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed };
68
69 // check (and set if necessary) the encrypted media extensions (EME) mode
70 // (v0.1b or WD). Returns whether the mode is allowed and successfully set.
71 bool setEmeMode(EmeMode, ExceptionState&);
72
73 blink::WebContentDecryptionModule* contentDecryptionModule();
74 void setMediaKeysInternal(MediaKeys*);
75
76 MediaPlayer* player();
acolwell GONE FROM CHROMIUM 2014/02/26 17:19:19 nit: Remove. It doesn't look like this is used/def
77 blink::WebMediaPlayer* webMediaPlayer();
78
79 EmeMode m_emeMode;
80
81 RefPtrWillBePersistent<MediaKeys> m_mediaKeys;
82 HTMLMediaElement& m_mediaElement;
83 };
84
85 }
86
87 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698