| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 186 } |
| 187 | 187 |
| 188 | 188 |
| 189 // 5. Let origin be the origin of document. | 189 // 5. Let origin be the origin of document. |
| 190 // (Passed with the execution context in step 7.) | 190 // (Passed with the execution context in step 7.) |
| 191 | 191 |
| 192 // 6. Let promise be a new promise. | 192 // 6. Let promise be a new promise. |
| 193 Document* document = toDocument(executionContext); | 193 Document* document = toDocument(executionContext); |
| 194 if (!document->page()) { | 194 if (!document->page()) { |
| 195 return ScriptPromise::rejectWithDOMException( | 195 return ScriptPromise::rejectWithDOMException( |
| 196 scriptState, DOMException::create(InvalidStateError, "Document does
not have a page.")); | 196 scriptState, DOMException::create(InvalidStateError, "The context pr
ovided is not associated with a page.")); |
| 197 } | 197 } |
| 198 | 198 |
| 199 MediaKeySystemAccessInitializer* initializer = new MediaKeySystemAccessIniti
alizer(scriptState, keySystem, supportedConfigurations); | 199 MediaKeySystemAccessInitializer* initializer = new MediaKeySystemAccessIniti
alizer(scriptState, keySystem, supportedConfigurations); |
| 200 ScriptPromise promise = initializer->promise(); | 200 ScriptPromise promise = initializer->promise(); |
| 201 | 201 |
| 202 // 7. Asynchronously determine support, and if allowed, create and | 202 // 7. Asynchronously determine support, and if allowed, create and |
| 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 |