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