OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... | |
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef MediaKeys_h | 26 #ifndef MediaKeys_h |
27 #define MediaKeys_h | 27 #define MediaKeys_h |
28 | 28 |
29 #include "bindings/v8/ScriptWrappable.h" | 29 #include "bindings/v8/ScriptWrappable.h" |
30 #include "core/events/EventTarget.h" | 30 #include "core/events/EventTarget.h" |
31 #include "modules/encryptedmedia/MediaKeySession.h" | |
acolwell GONE FROM CHROMIUM
2014/01/13 18:35:37
Why do you need to include this now?
xhwang
2014/01/13 19:06:03
For the template parameter on l.80.
| |
32 #include "platform/Timer.h" | |
33 #include "wtf/Deque.h" | |
31 #include "wtf/OwnPtr.h" | 34 #include "wtf/OwnPtr.h" |
32 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
33 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
34 #include "wtf/Uint8Array.h" | 37 #include "wtf/Uint8Array.h" |
35 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
36 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
37 | 40 |
38 namespace blink { | 41 namespace blink { |
39 class WebContentDecryptionModule; | 42 class WebContentDecryptionModule; |
40 } | 43 } |
41 | 44 |
42 namespace WebCore { | 45 namespace WebCore { |
43 | 46 |
44 class ContentDecryptionModule; | 47 class ContentDecryptionModule; |
45 class MediaKeySession; | |
46 class HTMLMediaElement; | 48 class HTMLMediaElement; |
47 class ExceptionState; | 49 class ExceptionState; |
48 | 50 |
49 // References are held by JS and HTMLMediaElement. | 51 // References are held by JS and HTMLMediaElement. |
50 // The ContentDecryptionModule has the same lifetime as this object. | 52 // The ContentDecryptionModule has the same lifetime as this object. |
51 // Maintains a reference to all MediaKeySessions created to ensure they live as | 53 // Maintains a reference to all MediaKeySessions created to ensure they live as |
52 // long as this object unless explicitly close()'d. | 54 // long as this object unless explicitly close()'d. |
53 class MediaKeys : public RefCounted<MediaKeys>, public ScriptWrappable { | 55 class MediaKeys : public RefCounted<MediaKeys>, public ScriptWrappable { |
54 public: | 56 public: |
55 static PassRefPtr<MediaKeys> create(const String& keySystem, ExceptionState& ); | 57 static PassRefPtr<MediaKeys> create(const String& keySystem, ExceptionState& ); |
56 ~MediaKeys(); | 58 ~MediaKeys(); |
57 | 59 |
58 PassRefPtr<MediaKeySession> createSession(ExecutionContext*, const String& m imeType, Uint8Array* initData, ExceptionState&); | 60 PassRefPtr<MediaKeySession> createSession(ExecutionContext*, const String& m imeType, Uint8Array* initData, ExceptionState&); |
59 | 61 |
60 const String& keySystem() const { return m_keySystem; } | 62 const String& keySystem() const { return m_keySystem; } |
61 | 63 |
62 void setMediaElement(HTMLMediaElement*); | 64 void setMediaElement(HTMLMediaElement*); |
63 | 65 |
64 blink::WebContentDecryptionModule* contentDecryptionModule(); | 66 blink::WebContentDecryptionModule* contentDecryptionModule(); |
65 | 67 |
66 protected: | 68 protected: |
67 MediaKeys(const String& keySystem, PassOwnPtr<ContentDecryptionModule>); | 69 MediaKeys(const String& keySystem, PassOwnPtr<ContentDecryptionModule>); |
70 void initializeNewSessionTimerFired(Timer<MediaKeys>*); | |
68 | 71 |
69 Vector<RefPtr<MediaKeySession> > m_sessions; | 72 Vector<RefPtr<MediaKeySession> > m_sessions; |
70 | 73 |
71 HTMLMediaElement* m_mediaElement; | 74 HTMLMediaElement* m_mediaElement; |
72 const String m_keySystem; | 75 const String m_keySystem; |
73 OwnPtr<ContentDecryptionModule> m_cdm; | 76 OwnPtr<ContentDecryptionModule> m_cdm; |
77 | |
78 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not pass it as a pointer. | |
79 struct InitializeNewSessionData { | |
80 InitializeNewSessionData(PassRefPtr<MediaKeySession> session, const Stri ng& mimeType, Uint8Array* initData) | |
acolwell GONE FROM CHROMIUM
2014/01/13 18:35:37
Use PassRefPtr<Uint8Array> for initData.
xhwang
2014/01/13 19:06:03
Done.
| |
81 : session(session) | |
82 , mimeType(mimeType) | |
83 , initData(initData) { } | |
84 RefPtr<MediaKeySession> session; | |
85 String mimeType; | |
86 RefPtr<Uint8Array> initData; | |
87 }; | |
88 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; | |
89 Timer<MediaKeys> m_initializeNewSessionTimer; | |
74 }; | 90 }; |
75 | 91 |
76 } | 92 } |
77 | 93 |
78 #endif // MediaKeys_h | 94 #endif // MediaKeys_h |
OLD | NEW |