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

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: Fix compilation error on linux Created 6 years, 9 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 namespace WebCore {
16
17 class ExceptionState;
18 class HTMLMediaElement;
19 class MediaKeys;
20
21 class HTMLMediaElementEncryptedMedia : public Supplement<HTMLMediaElement> {
22 public:
23 // encrypted media extensions (v0.1b)
24 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, PassRefPtr<Uint8Array> initData, ExceptionState&);
25 static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySys tem, ExceptionState&);
26 static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef Ptr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, E xceptionState&);
27 static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRef Ptr<Uint8Array> key, ExceptionState&);
28 static void webkitCancelKeyRequest(HTMLMediaElement&, const String& keySyste m, const String& sessionId, ExceptionState&);
29
30 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded);
31 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror);
32 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage);
33 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitneedkey);
34
35 // encrypted media extensions (WD)
36 static MediaKeys* mediaKeys(HTMLMediaElement&);
37 static void setMediaKeys(HTMLMediaElement&, MediaKeys*, ExceptionState&);
38 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(needkey);
39
40 static void keyAdded(HTMLMediaElement&, const String& keySystem, const Strin g& sessionId);
41 static void keyError(HTMLMediaElement&, const String& keySystem, const Strin g& sessionId, blink::WebMediaPlayerClient::MediaKeyErrorCode, unsigned short sys temCode);
42 static void keyMessage(HTMLMediaElement&, const String& keySystem, const Str ing& sessionId, const unsigned char* message, unsigned messageLength, const blin k::WebURL& defaultURL);
43 static void keyNeeded(HTMLMediaElement&, const String& contentType, const un signed char* initData, unsigned initDataLength);
44 static void playerDestroyed(HTMLMediaElement&);
45 static blink::WebContentDecryptionModule* contentDecryptionModule(HTMLMediaE lement&);
46
47 virtual ~HTMLMediaElementEncryptedMedia();
48 static HTMLMediaElementEncryptedMedia& from(HTMLMediaElement&);
49 static const char* supplementName();
50
51 private:
52 HTMLMediaElementEncryptedMedia();
53 void generateKeyRequest(blink::WebMediaPlayer*, const String& keySystem, Pas sRefPtr<Uint8Array> initData, ExceptionState&);
54 void addKey(blink::WebMediaPlayer*, const String& keySystem, PassRefPtr<Uint 8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, Exception State&);
55 void cancelKeyRequest(blink::WebMediaPlayer*, const String& keySystem, const String& sessionId, ExceptionState&);
56
57 // EventTarget
58 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>);
59 EventListener* getAttributeEventListener(const AtomicString& eventType);
60
61 // Currently we have both EME v0.1b and EME WD implemented in media element.
62 // But we do not want to support both at the same time. The one used first
63 // will be supported. Use |m_emeMode| to track this selection.
64 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24 9976.
65 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed };
66
67 // check (and set if necessary) the encrypted media extensions (EME) mode
68 // (v0.1b or WD). Returns whether the mode is allowed and successfully set.
69 bool setEmeMode(EmeMode, ExceptionState&);
70
71 blink::WebContentDecryptionModule* contentDecryptionModule();
72 void setMediaKeysInternal(HTMLMediaElement&, MediaKeys*);
73
74 EmeMode m_emeMode;
75
76 RefPtrWillBePersistent<MediaKeys> m_mediaKeys;
77 };
78
79 }
80
81 #endif
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.idl ('k') | Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698