| 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" | |
| 28 #include "wtf/Vector.h" | 27 #include "wtf/Vector.h" |
| 29 #include "wtf/text/WTFString.h" | 28 #include "wtf/text/WTFString.h" |
| 30 #include <algorithm> | 29 #include <algorithm> |
| 31 | 30 |
| 32 namespace blink { | 31 namespace blink { |
| 33 | 32 |
| 34 namespace { | 33 namespace { |
| 35 | 34 |
| 36 static WebVector<WebEncryptedMediaInitDataType> convertInitDataTypes(const Vecto
r<String>& initDataTypes) | 35 static WebVector<WebEncryptedMediaInitDataType> convertInitDataTypes(const Vecto
r<String>& initDataTypes) |
| 37 { | 36 { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 m_supportedConfigurations[i] = webConfig; | 160 m_supportedConfigurations[i] = webConfig; |
| 162 } | 161 } |
| 163 | 162 |
| 164 checkVideoCapabilityRobustness(); | 163 checkVideoCapabilityRobustness(); |
| 165 } | 164 } |
| 166 | 165 |
| 167 void MediaKeySystemAccessInitializer::requestSucceeded(WebContentDecryptionModul
eAccess* access) | 166 void MediaKeySystemAccessInitializer::requestSucceeded(WebContentDecryptionModul
eAccess* access) |
| 168 { | 167 { |
| 169 checkEmptyCodecs(access->getConfiguration()); | 168 checkEmptyCodecs(access->getConfiguration()); |
| 170 | 169 |
| 171 m_resolver->resolve(new MediaKeySystemAccess(m_keySystem, wrapUnique(access)
)); | 170 m_resolver->resolve(new MediaKeySystemAccess(m_keySystem, adoptPtr(access)))
; |
| 172 m_resolver.clear(); | 171 m_resolver.clear(); |
| 173 } | 172 } |
| 174 | 173 |
| 175 void MediaKeySystemAccessInitializer::requestNotSupported(const WebString& error
Message) | 174 void MediaKeySystemAccessInitializer::requestNotSupported(const WebString& error
Message) |
| 176 { | 175 { |
| 177 m_resolver->reject(DOMException::create(NotSupportedError, errorMessage)); | 176 m_resolver->reject(DOMException::create(NotSupportedError, errorMessage)); |
| 178 m_resolver.clear(); | 177 m_resolver.clear(); |
| 179 } | 178 } |
| 180 | 179 |
| 181 void MediaKeySystemAccessInitializer::checkVideoCapabilityRobustness() const | 180 void MediaKeySystemAccessInitializer::checkVideoCapabilityRobustness() const |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // initialize the MediaKeySystemAccess object. | 297 // initialize the MediaKeySystemAccess object. |
| 299 MediaKeysController* controller = MediaKeysController::from(document->page()
); | 298 MediaKeysController* controller = MediaKeysController::from(document->page()
); |
| 300 WebEncryptedMediaClient* mediaClient = controller->encryptedMediaClient(exec
utionContext); | 299 WebEncryptedMediaClient* mediaClient = controller->encryptedMediaClient(exec
utionContext); |
| 301 mediaClient->requestMediaKeySystemAccess(WebEncryptedMediaRequest(initialize
r)); | 300 mediaClient->requestMediaKeySystemAccess(WebEncryptedMediaRequest(initialize
r)); |
| 302 | 301 |
| 303 // 8. Return promise. | 302 // 8. Return promise. |
| 304 return promise; | 303 return promise; |
| 305 } | 304 } |
| 306 | 305 |
| 307 } // namespace blink | 306 } // namespace blink |
| OLD | NEW |