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