| 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/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
| 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 "bindings/core/v8/V8ThrowException.h" | 10 #include "bindings/core/v8/V8ThrowException.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 void MediaKeySystemAccessInitializer::requestNotSupported( | 215 void MediaKeySystemAccessInitializer::requestNotSupported( |
| 216 const WebString& errorMessage) { | 216 const WebString& errorMessage) { |
| 217 if (!isExecutionContextValid()) | 217 if (!isExecutionContextValid()) |
| 218 return; | 218 return; |
| 219 | 219 |
| 220 m_resolver->reject(DOMException::create(NotSupportedError, errorMessage)); | 220 m_resolver->reject(DOMException::create(NotSupportedError, errorMessage)); |
| 221 m_resolver.clear(); | 221 m_resolver.clear(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 bool MediaKeySystemAccessInitializer::isExecutionContextValid() const { | 224 bool MediaKeySystemAccessInitializer::isExecutionContextValid() const { |
| 225 // activeDOMObjectsAreStopped() is called to see if the context is in the | 225 // isContextDestroyed() is called to see if the context is in the |
| 226 // process of being destroyed. If it is true, assume the context is no | 226 // process of being destroyed. If it is true, assume the context is no |
| 227 // longer valid as it is about to be destroyed anyway. | 227 // longer valid as it is about to be destroyed anyway. |
| 228 ExecutionContext* context = m_resolver->getExecutionContext(); | 228 ExecutionContext* context = m_resolver->getExecutionContext(); |
| 229 return context && !context->activeDOMObjectsAreStopped(); | 229 return context && !context->isContextDestroyed(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void MediaKeySystemAccessInitializer::checkVideoCapabilityRobustness() const { | 232 void MediaKeySystemAccessInitializer::checkVideoCapabilityRobustness() const { |
| 233 // Only check for widevine key system. | 233 // Only check for widevine key system. |
| 234 if (keySystem() != "com.widevine.alpha") | 234 if (keySystem() != "com.widevine.alpha") |
| 235 return; | 235 return; |
| 236 | 236 |
| 237 bool hasVideoCapabilities = false; | 237 bool hasVideoCapabilities = false; |
| 238 bool hasEmptyRobustness = false; | 238 bool hasEmptyRobustness = false; |
| 239 | 239 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 WebEncryptedMediaClient* mediaClient = | 390 WebEncryptedMediaClient* mediaClient = |
| 391 controller->encryptedMediaClient(executionContext); | 391 controller->encryptedMediaClient(executionContext); |
| 392 mediaClient->requestMediaKeySystemAccess( | 392 mediaClient->requestMediaKeySystemAccess( |
| 393 WebEncryptedMediaRequest(initializer)); | 393 WebEncryptedMediaRequest(initializer)); |
| 394 | 394 |
| 395 // 7. Return promise. | 395 // 7. Return promise. |
| 396 return promise; | 396 return promise; |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace blink | 399 } // namespace blink |
| OLD | NEW |