OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" | 6 #include "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return result; | 77 return result; |
78 } | 78 } |
79 | 79 |
80 // This class allows capabilities to be checked and a MediaKeySystemAccess | 80 // This class allows capabilities to be checked and a MediaKeySystemAccess |
81 // object to be created asynchronously. | 81 // object to be created asynchronously. |
82 class MediaKeySystemAccessInitializer final : public EncryptedMediaRequest { | 82 class MediaKeySystemAccessInitializer final : public EncryptedMediaRequest { |
83 WTF_MAKE_NONCOPYABLE(MediaKeySystemAccessInitializer); | 83 WTF_MAKE_NONCOPYABLE(MediaKeySystemAccessInitializer); |
84 | 84 |
85 public: | 85 public: |
86 MediaKeySystemAccessInitializer(ScriptState*, const String& keySystem, const
HeapVector<MediaKeySystemConfiguration>& supportedConfigurations); | 86 MediaKeySystemAccessInitializer(ScriptState*, const String& keySystem, const
HeapVector<MediaKeySystemConfiguration>& supportedConfigurations); |
87 virtual ~MediaKeySystemAccessInitializer() { } | 87 ~MediaKeySystemAccessInitializer() override { } |
88 | 88 |
89 // EncryptedMediaRequest implementation. | 89 // EncryptedMediaRequest implementation. |
90 virtual WebString keySystem() const override { return m_keySystem; } | 90 WebString keySystem() const override { return m_keySystem; } |
91 virtual const WebVector<WebMediaKeySystemConfiguration>& supportedConfigurat
ions() const override { return m_supportedConfigurations; } | 91 const WebVector<WebMediaKeySystemConfiguration>& supportedConfigurations() c
onst override { return m_supportedConfigurations; } |
92 virtual SecurityOrigin* securityOrigin() const override { return m_resolver-
>executionContext()->securityOrigin(); } | 92 SecurityOrigin* securityOrigin() const override { return m_resolver->executi
onContext()->securityOrigin(); } |
93 virtual void requestSucceeded(WebContentDecryptionModuleAccess*) override; | 93 void requestSucceeded(WebContentDecryptionModuleAccess*) override; |
94 virtual void requestNotSupported(const WebString& errorMessage) override; | 94 void requestNotSupported(const WebString& errorMessage) override; |
95 | 95 |
96 ScriptPromise promise() { return m_resolver->promise(); } | 96 ScriptPromise promise() { return m_resolver->promise(); } |
97 | 97 |
98 private: | 98 private: |
99 RefPtr<ScriptPromiseResolver> m_resolver; | 99 RefPtr<ScriptPromiseResolver> m_resolver; |
100 const String m_keySystem; | 100 const String m_keySystem; |
101 WebVector<WebMediaKeySystemConfiguration> m_supportedConfigurations; | 101 WebVector<WebMediaKeySystemConfiguration> m_supportedConfigurations; |
102 }; | 102 }; |
103 | 103 |
104 MediaKeySystemAccessInitializer::MediaKeySystemAccessInitializer(ScriptState* sc
riptState, const String& keySystem, const HeapVector<MediaKeySystemConfiguration
>& supportedConfigurations) | 104 MediaKeySystemAccessInitializer::MediaKeySystemAccessInitializer(ScriptState* sc
riptState, const String& keySystem, const HeapVector<MediaKeySystemConfiguration
>& supportedConfigurations) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // initialize the MediaKeySystemAccess object. | 203 // initialize the MediaKeySystemAccess object. |
204 MediaKeysController* controller = MediaKeysController::from(document->page()
); | 204 MediaKeysController* controller = MediaKeysController::from(document->page()
); |
205 WebEncryptedMediaClient* mediaClient = controller->encryptedMediaClient(exec
utionContext); | 205 WebEncryptedMediaClient* mediaClient = controller->encryptedMediaClient(exec
utionContext); |
206 mediaClient->requestMediaKeySystemAccess(WebEncryptedMediaRequest(initialize
r)); | 206 mediaClient->requestMediaKeySystemAccess(WebEncryptedMediaRequest(initialize
r)); |
207 | 207 |
208 // 8. Return promise. | 208 // 8. Return promise. |
209 return promise; | 209 return promise; |
210 } | 210 } |
211 | 211 |
212 } // namespace blink | 212 } // namespace blink |
OLD | NEW |