| 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 13 matching lines...) Expand all Loading... |
| 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 "core/dom/DOMArrayPiece.h" | 32 #include "core/dom/DOMArrayPiece.h" |
| 33 #include "platform/Timer.h" | 33 #include "platform/Timer.h" |
| 34 #include "public/platform/WebContentDecryptionModule.h" |
| 34 #include "public/platform/WebEncryptedMediaTypes.h" | 35 #include "public/platform/WebEncryptedMediaTypes.h" |
| 35 #include "public/platform/WebString.h" | 36 #include "public/platform/WebString.h" |
| 36 #include "public/platform/WebVector.h" | 37 #include "public/platform/WebVector.h" |
| 37 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
| 38 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 class ExceptionState; | 43 class ExceptionState; |
| 43 class ExecutionContext; | 44 class ExecutionContext; |
| 44 class MediaKeySession; | 45 class MediaKeySession; |
| 45 class ScriptState; | 46 class ScriptState; |
| 46 class WebContentDecryptionModule; | 47 class WebContentDecryptionModule; |
| 47 | 48 |
| 48 // References are held by JS and HTMLMediaElement. | 49 // References are held by JS and HTMLMediaElement. |
| 49 // The WebContentDecryptionModule has the same lifetime as this object. | 50 // The WebContentDecryptionModule has the same lifetime as this object. |
| 50 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ContextLif
ecycleObserver, public ScriptWrappable { | 51 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ContextLif
ecycleObserver, public ScriptWrappable { |
| 51 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeys); | 52 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeys); |
| 52 DEFINE_WRAPPERTYPEINFO(); | 53 DEFINE_WRAPPERTYPEINFO(); |
| 53 public: | 54 public: |
| 54 MediaKeys(ExecutionContext*, const String& keySystem, const blink::WebVector
<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecr
yptionModule>); | 55 MediaKeys(ExecutionContext*, const String& keySystem, const WebVector<WebEnc
ryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionM
odule>); |
| 55 virtual ~MediaKeys(); | 56 virtual ~MediaKeys(); |
| 56 | 57 |
| 57 // FIXME: This should be removed after crbug.com/425186 is fully | 58 // FIXME: This should be removed after crbug.com/425186 is fully |
| 58 // implemented. | 59 // implemented. |
| 59 const String& keySystem() const { return m_keySystem; } | 60 const String& keySystem() const { return m_keySystem; } |
| 60 | 61 |
| 61 MediaKeySession* createSession(ScriptState*, const String& sessionTypeString
, ExceptionState&); | 62 MediaKeySession* createSession(ScriptState*, const String& sessionTypeString
, ExceptionState&); |
| 62 | 63 |
| 63 ScriptPromise setServerCertificate(ScriptState*, const DOMArrayPiece& server
Certificate); | 64 ScriptPromise setServerCertificate(ScriptState*, const DOMArrayPiece& server
Certificate); |
| 64 | 65 |
| 65 blink::WebContentDecryptionModule* contentDecryptionModule(); | 66 WebContentDecryptionModule* contentDecryptionModule(); |
| 66 | 67 |
| 67 DECLARE_VIRTUAL_TRACE(); | 68 DECLARE_VIRTUAL_TRACE(); |
| 68 | 69 |
| 69 // ContextLifecycleObserver | 70 // ContextLifecycleObserver |
| 70 virtual void contextDestroyed() override; | 71 virtual void contextDestroyed() override; |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 class PendingAction; | 74 class PendingAction; |
| 74 | 75 |
| 75 bool sessionTypeSupported(WebEncryptedMediaSessionType); | 76 bool sessionTypeSupported(WebEncryptedMediaSessionType); |
| 76 void timerFired(Timer<MediaKeys>*); | 77 void timerFired(Timer<MediaKeys>*); |
| 77 | 78 |
| 78 const String m_keySystem; | 79 const String m_keySystem; |
| 79 const blink::WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes
; | 80 const WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes; |
| 80 OwnPtr<blink::WebContentDecryptionModule> m_cdm; | 81 OwnPtr<WebContentDecryptionModule> m_cdm; |
| 81 | 82 |
| 82 HeapDeque<Member<PendingAction>> m_pendingActions; | 83 HeapDeque<Member<PendingAction>> m_pendingActions; |
| 83 Timer<MediaKeys> m_timer; | 84 Timer<MediaKeys> m_timer; |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 } // namespace blink | 87 } // namespace blink |
| 87 | 88 |
| 88 #endif // MediaKeys_h | 89 #endif // MediaKeys_h |
| OLD | NEW |