| 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 "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" | 5 #include "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| 11 #include "core/dom/ExceptionCode.h" | 11 #include "core/dom/ExceptionCode.h" |
| 12 #include "core/frame/Deprecation.h" | 12 #include "core/frame/Deprecation.h" |
| 13 #include "core/inspector/ConsoleMessage.h" | 13 #include "core/inspector/ConsoleMessage.h" |
| 14 #include "modules/encryptedmedia/EncryptedMediaUtils.h" | 14 #include "modules/encryptedmedia/EncryptedMediaUtils.h" |
| 15 #include "modules/encryptedmedia/MediaKeySession.h" | 15 #include "modules/encryptedmedia/MediaKeySession.h" |
| 16 #include "modules/encryptedmedia/MediaKeySystemAccess.h" | 16 #include "modules/encryptedmedia/MediaKeySystemAccess.h" |
| 17 #include "modules/encryptedmedia/MediaKeysController.h" | 17 #include "modules/encryptedmedia/MediaKeysController.h" |
| 18 #include "platform/EncryptedMediaRequest.h" | 18 #include "platform/EncryptedMediaRequest.h" |
| 19 #include "platform/Histogram.h" | 19 #include "platform/Histogram.h" |
| 20 #include "platform/Logging.h" | 20 #include "platform/Logging.h" |
| 21 #include "platform/network/ParsedContentType.h" | 21 #include "platform/network/ParsedContentType.h" |
| 22 #include "public/platform/WebEncryptedMediaClient.h" | 22 #include "public/platform/WebEncryptedMediaClient.h" |
| 23 #include "public/platform/WebEncryptedMediaRequest.h" | 23 #include "public/platform/WebEncryptedMediaRequest.h" |
| 24 #include "public/platform/WebMediaKeySystemConfiguration.h" | 24 #include "public/platform/WebMediaKeySystemConfiguration.h" |
| 25 #include "public/platform/WebMediaKeySystemMediaCapability.h" | 25 #include "public/platform/WebMediaKeySystemMediaCapability.h" |
| 26 #include "public/platform/WebVector.h" | 26 #include "public/platform/WebVector.h" |
| 27 #include "wtf/PtrUtil.h" |
| 27 #include "wtf/Vector.h" | 28 #include "wtf/Vector.h" |
| 28 #include "wtf/text/WTFString.h" | 29 #include "wtf/text/WTFString.h" |
| 29 #include <algorithm> | 30 #include <algorithm> |
| 30 | 31 |
| 31 namespace blink { | 32 namespace blink { |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 | 35 |
| 35 static WebVector<WebEncryptedMediaInitDataType> convertInitDataTypes(const Vecto
r<String>& initDataTypes) | 36 static WebVector<WebEncryptedMediaInitDataType> convertInitDataTypes(const Vecto
r<String>& initDataTypes) |
| 36 { | 37 { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 m_supportedConfigurations[i] = webConfig; | 161 m_supportedConfigurations[i] = webConfig; |
| 161 } | 162 } |
| 162 | 163 |
| 163 checkVideoCapabilityRobustness(); | 164 checkVideoCapabilityRobustness(); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void MediaKeySystemAccessInitializer::requestSucceeded(WebContentDecryptionModul
eAccess* access) | 167 void MediaKeySystemAccessInitializer::requestSucceeded(WebContentDecryptionModul
eAccess* access) |
| 167 { | 168 { |
| 168 checkEmptyCodecs(access->getConfiguration()); | 169 checkEmptyCodecs(access->getConfiguration()); |
| 169 | 170 |
| 170 m_resolver->resolve(new MediaKeySystemAccess(m_keySystem, adoptPtr(access)))
; | 171 m_resolver->resolve(new MediaKeySystemAccess(m_keySystem, wrapUnique(access)
)); |
| 171 m_resolver.clear(); | 172 m_resolver.clear(); |
| 172 } | 173 } |
| 173 | 174 |
| 174 void MediaKeySystemAccessInitializer::requestNotSupported(const WebString& error
Message) | 175 void MediaKeySystemAccessInitializer::requestNotSupported(const WebString& error
Message) |
| 175 { | 176 { |
| 176 m_resolver->reject(DOMException::create(NotSupportedError, errorMessage)); | 177 m_resolver->reject(DOMException::create(NotSupportedError, errorMessage)); |
| 177 m_resolver.clear(); | 178 m_resolver.clear(); |
| 178 } | 179 } |
| 179 | 180 |
| 180 void MediaKeySystemAccessInitializer::checkVideoCapabilityRobustness() const | 181 void MediaKeySystemAccessInitializer::checkVideoCapabilityRobustness() const |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // initialize the MediaKeySystemAccess object. | 298 // initialize the MediaKeySystemAccess object. |
| 298 MediaKeysController* controller = MediaKeysController::from(document->page()
); | 299 MediaKeysController* controller = MediaKeysController::from(document->page()
); |
| 299 WebEncryptedMediaClient* mediaClient = controller->encryptedMediaClient(exec
utionContext); | 300 WebEncryptedMediaClient* mediaClient = controller->encryptedMediaClient(exec
utionContext); |
| 300 mediaClient->requestMediaKeySystemAccess(WebEncryptedMediaRequest(initialize
r)); | 301 mediaClient->requestMediaKeySystemAccess(WebEncryptedMediaRequest(initialize
r)); |
| 301 | 302 |
| 302 // 8. Return promise. | 303 // 8. Return promise. |
| 303 return promise; | 304 return promise; |
| 304 } | 305 } |
| 305 | 306 |
| 306 } // namespace blink | 307 } // namespace blink |
| OLD | NEW |