| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return ScriptPromise::reject( | 288 return ScriptPromise::reject( |
| 289 scriptState, | 289 scriptState, |
| 290 V8ThrowException::createTypeError(scriptState->isolate(), | 290 V8ThrowException::createTypeError(scriptState->isolate(), |
| 291 "The keySystem parameter is empty.")); | 291 "The keySystem parameter is empty.")); |
| 292 } | 292 } |
| 293 | 293 |
| 294 // 2. If supportedConfigurations is empty, return a promise rejected with | 294 // 2. If supportedConfigurations is empty, return a promise rejected with |
| 295 // a newly created TypeError. | 295 // a newly created TypeError. |
| 296 if (!supportedConfigurations.size()) { | 296 if (!supportedConfigurations.size()) { |
| 297 return ScriptPromise::reject( | 297 return ScriptPromise::reject( |
| 298 scriptState, V8ThrowException::createTypeError( | 298 scriptState, |
| 299 scriptState->isolate(), | 299 V8ThrowException::createTypeError( |
| 300 "The supportedConfigurations parameter is empty.")); | 300 scriptState->isolate(), |
| 301 "The supportedConfigurations parameter is empty.")); |
| 301 } | 302 } |
| 302 | 303 |
| 303 // 3. Let document be the calling context's Document. | 304 // 3. Let document be the calling context's Document. |
| 304 // (Done at the begining of this function.) | 305 // (Done at the begining of this function.) |
| 305 if (!document->page()) { | 306 if (!document->page()) { |
| 306 return ScriptPromise::rejectWithDOMException( | 307 return ScriptPromise::rejectWithDOMException( |
| 307 scriptState, | 308 scriptState, |
| 308 DOMException::create( | 309 DOMException::create( |
| 309 InvalidStateError, | 310 InvalidStateError, |
| 310 "The context provided is not associated with a page.")); | 311 "The context provided is not associated with a page.")); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 325 WebEncryptedMediaClient* mediaClient = | 326 WebEncryptedMediaClient* mediaClient = |
| 326 controller->encryptedMediaClient(executionContext); | 327 controller->encryptedMediaClient(executionContext); |
| 327 mediaClient->requestMediaKeySystemAccess( | 328 mediaClient->requestMediaKeySystemAccess( |
| 328 WebEncryptedMediaRequest(initializer)); | 329 WebEncryptedMediaRequest(initializer)); |
| 329 | 330 |
| 330 // 7. Return promise. | 331 // 7. Return promise. |
| 331 return promise; | 332 return promise; |
| 332 } | 333 } |
| 333 | 334 |
| 334 } // namespace blink | 335 } // namespace blink |
| OLD | NEW |