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