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 11 matching lines...) Expand all Loading... |
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/core/v8/ScriptPromise.h" | 29 #include "bindings/core/v8/ScriptPromise.h" |
30 #include "bindings/core/v8/ScriptWrappable.h" | 30 #include "bindings/core/v8/ScriptWrappable.h" |
31 #include "core/dom/ContextLifecycleObserver.h" | 31 #include "core/dom/ContextLifecycleObserver.h" |
| 32 #include "platform/Timer.h" |
32 #include "wtf/Forward.h" | 33 #include "wtf/Forward.h" |
33 #include "wtf/text/WTFString.h" | 34 #include "wtf/text/WTFString.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 class ExceptionState; | 38 class ExceptionState; |
38 class ExecutionContext; | 39 class ExecutionContext; |
39 class HTMLMediaElement; | 40 class HTMLMediaElement; |
40 class MediaKeySession; | 41 class MediaKeySession; |
41 class ScriptState; | 42 class ScriptState; |
42 class WebContentDecryptionModule; | 43 class WebContentDecryptionModule; |
43 | 44 |
44 // References are held by JS and HTMLMediaElement. | 45 // References are held by JS and HTMLMediaElement. |
45 // The WebContentDecryptionModule has the same lifetime as this object. | 46 // The WebContentDecryptionModule has the same lifetime as this object. |
46 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ContextLif
ecycleObserver, public ScriptWrappable { | 47 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ContextLif
ecycleObserver, public ScriptWrappable { |
47 DEFINE_WRAPPERTYPEINFO(); | 48 DEFINE_WRAPPERTYPEINFO(); |
48 public: | 49 public: |
49 static ScriptPromise create(ScriptState*, const String& keySystem); | 50 static ScriptPromise create(ScriptState*, const String& keySystem); |
50 virtual ~MediaKeys(); | 51 virtual ~MediaKeys(); |
51 | 52 |
52 const String& keySystem() const { return m_keySystem; } | 53 const String& keySystem() const { return m_keySystem; } |
53 | 54 |
54 MediaKeySession* createSession(ScriptState*, const String& sessionType); | 55 MediaKeySession* createSession(ScriptState*, const String& sessionType); |
55 | 56 |
| 57 ScriptPromise setServerCertificate(ScriptState*, ArrayBuffer* serverCertific
ate); |
| 58 ScriptPromise setServerCertificate(ScriptState*, ArrayBufferView* serverCert
ificate); |
| 59 |
56 static bool isTypeSupported(const String& keySystem, const String& contentTy
pe); | 60 static bool isTypeSupported(const String& keySystem, const String& contentTy
pe); |
57 | 61 |
58 blink::WebContentDecryptionModule* contentDecryptionModule(); | 62 blink::WebContentDecryptionModule* contentDecryptionModule(); |
59 | 63 |
60 void trace(Visitor*); | 64 void trace(Visitor*); |
61 | 65 |
62 // ContextLifecycleObserver | 66 // ContextLifecycleObserver |
63 virtual void contextDestroyed() override; | 67 virtual void contextDestroyed() override; |
64 | 68 |
65 private: | 69 private: |
| 70 class PendingAction; |
66 friend class MediaKeysInitializer; | 71 friend class MediaKeysInitializer; |
67 MediaKeys(ExecutionContext*, const String& keySystem, PassOwnPtr<blink::WebC
ontentDecryptionModule>); | 72 MediaKeys(ExecutionContext*, const String& keySystem, PassOwnPtr<blink::WebC
ontentDecryptionModule>); |
68 | 73 |
| 74 ScriptPromise setServerCertificateInternal(ScriptState*, PassRefPtr<ArrayBuf
fer> initData); |
| 75 |
| 76 void timerFired(Timer<MediaKeys>*); |
| 77 |
69 const String m_keySystem; | 78 const String m_keySystem; |
70 OwnPtr<blink::WebContentDecryptionModule> m_cdm; | 79 OwnPtr<blink::WebContentDecryptionModule> m_cdm; |
| 80 |
| 81 HeapDeque<Member<PendingAction> > m_pendingActions; |
| 82 Timer<MediaKeys> m_timer; |
71 }; | 83 }; |
72 | 84 |
73 } // namespace blink | 85 } // namespace blink |
74 | 86 |
75 #endif // MediaKeys_h | 87 #endif // MediaKeys_h |
OLD | NEW |