| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 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/core/v8/ActiveScriptWrappable.h" |
| 29 #include "bindings/core/v8/ScriptPromise.h" | 30 #include "bindings/core/v8/ScriptPromise.h" |
| 30 #include "bindings/core/v8/ScriptWrappable.h" | 31 #include "bindings/core/v8/ScriptWrappable.h" |
| 31 #include "core/dom/ActiveDOMObject.h" | 32 #include "core/dom/ActiveDOMObject.h" |
| 32 #include "core/dom/DOMArrayPiece.h" | 33 #include "core/dom/DOMArrayPiece.h" |
| 33 #include "platform/Timer.h" | 34 #include "platform/Timer.h" |
| 34 #include "public/platform/WebContentDecryptionModule.h" | 35 #include "public/platform/WebContentDecryptionModule.h" |
| 35 #include "public/platform/WebEncryptedMediaTypes.h" | 36 #include "public/platform/WebEncryptedMediaTypes.h" |
| 36 #include "public/platform/WebString.h" | 37 #include "public/platform/WebString.h" |
| 37 #include "public/platform/WebVector.h" | 38 #include "public/platform/WebVector.h" |
| 38 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
| 39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 class ExceptionState; | 44 class ExceptionState; |
| 44 class ExecutionContext; | 45 class ExecutionContext; |
| 45 class HTMLMediaElement; | 46 class HTMLMediaElement; |
| 46 class MediaKeySession; | 47 class MediaKeySession; |
| 47 class ScriptState; | 48 class ScriptState; |
| 48 class WebContentDecryptionModule; | 49 class WebContentDecryptionModule; |
| 49 | 50 |
| 50 // References are held by JS and HTMLMediaElement. | 51 // References are held by JS and HTMLMediaElement. |
| 51 // The WebContentDecryptionModule has the same lifetime as this object. | 52 // The WebContentDecryptionModule has the same lifetime as this object. |
| 52 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ActiveDOMO
bject, public ScriptWrappable { | 53 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ActiveScri
ptWrappable, public ActiveDOMObject, public ScriptWrappable { |
| 53 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeys); | 54 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeys); |
| 54 DEFINE_WRAPPERTYPEINFO(); | 55 DEFINE_WRAPPERTYPEINFO(); |
| 55 public: | 56 public: |
| 56 static MediaKeys* create(ExecutionContext*, const WebVector<WebEncryptedMedi
aSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule>); | 57 static MediaKeys* create(ExecutionContext*, const WebVector<WebEncryptedMedi
aSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule>); |
| 57 ~MediaKeys() override; | 58 ~MediaKeys() override; |
| 58 | 59 |
| 59 MediaKeySession* createSession(ScriptState*, const String& sessionTypeString
, ExceptionState&); | 60 MediaKeySession* createSession(ScriptState*, const String& sessionTypeString
, ExceptionState&); |
| 60 | 61 |
| 61 ScriptPromise setServerCertificate(ScriptState*, const DOMArrayPiece& server
Certificate); | 62 ScriptPromise setServerCertificate(ScriptState*, const DOMArrayPiece& server
Certificate); |
| 62 | 63 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 75 // The previously reserved and accepted HTMLMediaElement is no longer | 76 // The previously reserved and accepted HTMLMediaElement is no longer |
| 76 // using this object. | 77 // using this object. |
| 77 void clearMediaElement(); | 78 void clearMediaElement(); |
| 78 | 79 |
| 79 WebContentDecryptionModule* contentDecryptionModule(); | 80 WebContentDecryptionModule* contentDecryptionModule(); |
| 80 | 81 |
| 81 DECLARE_VIRTUAL_TRACE(); | 82 DECLARE_VIRTUAL_TRACE(); |
| 82 | 83 |
| 83 // ActiveDOMObject implementation. | 84 // ActiveDOMObject implementation. |
| 84 // FIXME: This class could derive from ContextLifecycleObserver | 85 // FIXME: This class could derive from ContextLifecycleObserver |
| 85 // again once hasPendingActivity() is moved to ScriptWrappable | 86 // again (http://crbug.com/483722). |
| 86 // (http://crbug.com/483722). | |
| 87 void contextDestroyed() override; | 87 void contextDestroyed() override; |
| 88 bool hasPendingActivity() const override; | |
| 89 void stop() override; | 88 void stop() override; |
| 90 | 89 |
| 90 // ActiveScriptWrappable implementation. |
| 91 bool hasPendingActivity() const final; |
| 92 |
| 91 private: | 93 private: |
| 92 MediaKeys(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>&
supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule>); | 94 MediaKeys(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>&
supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule>); |
| 93 class PendingAction; | 95 class PendingAction; |
| 94 | 96 |
| 95 bool sessionTypeSupported(WebEncryptedMediaSessionType); | 97 bool sessionTypeSupported(WebEncryptedMediaSessionType); |
| 96 void timerFired(Timer<MediaKeys>*); | 98 void timerFired(Timer<MediaKeys>*); |
| 97 | 99 |
| 98 const WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes; | 100 const WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes; |
| 99 OwnPtr<WebContentDecryptionModule> m_cdm; | 101 OwnPtr<WebContentDecryptionModule> m_cdm; |
| 100 | 102 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 112 // object will be prevented until the setMediaKeys() completes. | 114 // object will be prevented until the setMediaKeys() completes. |
| 113 bool m_reservedForMediaElement; | 115 bool m_reservedForMediaElement; |
| 114 | 116 |
| 115 HeapDeque<Member<PendingAction>> m_pendingActions; | 117 HeapDeque<Member<PendingAction>> m_pendingActions; |
| 116 Timer<MediaKeys> m_timer; | 118 Timer<MediaKeys> m_timer; |
| 117 }; | 119 }; |
| 118 | 120 |
| 119 } // namespace blink | 121 } // namespace blink |
| 120 | 122 |
| 121 #endif // MediaKeys_h | 123 #endif // MediaKeys_h |
| OLD | NEW |