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" |
11 #include "bindings/core/v8/ScriptState.h" | 11 #include "bindings/core/v8/ScriptState.h" |
12 #include "bindings/core/v8/V8ThrowException.h" | 12 #include "bindings/core/v8/V8ThrowException.h" |
13 #include "core/dom/DOMException.h" | 13 #include "core/dom/DOMException.h" |
14 #include "core/dom/Document.h" | 14 #include "core/dom/Document.h" |
15 #include "core/dom/ExceptionCode.h" | 15 #include "core/dom/ExceptionCode.h" |
| 16 #include "core/dom/ExecutionContext.h" |
16 #include "core/frame/Deprecation.h" | 17 #include "core/frame/Deprecation.h" |
17 #include "core/frame/Settings.h" | 18 #include "core/frame/Settings.h" |
18 #include "core/inspector/ConsoleMessage.h" | 19 #include "core/inspector/ConsoleMessage.h" |
19 #include "modules/encryptedmedia/EncryptedMediaUtils.h" | 20 #include "modules/encryptedmedia/EncryptedMediaUtils.h" |
20 #include "modules/encryptedmedia/MediaKeySession.h" | 21 #include "modules/encryptedmedia/MediaKeySession.h" |
21 #include "modules/encryptedmedia/MediaKeySystemAccess.h" | 22 #include "modules/encryptedmedia/MediaKeySystemAccess.h" |
22 #include "modules/encryptedmedia/MediaKeysController.h" | 23 #include "modules/encryptedmedia/MediaKeysController.h" |
23 #include "platform/EncryptedMediaRequest.h" | 24 #include "platform/EncryptedMediaRequest.h" |
24 #include "platform/Histogram.h" | 25 #include "platform/Histogram.h" |
25 #include "platform/network/ParsedContentType.h" | 26 #include "platform/network/ParsedContentType.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 260 |
260 } // namespace | 261 } // namespace |
261 | 262 |
262 ScriptPromise NavigatorRequestMediaKeySystemAccess::requestMediaKeySystemAccess( | 263 ScriptPromise NavigatorRequestMediaKeySystemAccess::requestMediaKeySystemAccess( |
263 ScriptState* script_state, | 264 ScriptState* script_state, |
264 Navigator& navigator, | 265 Navigator& navigator, |
265 const String& key_system, | 266 const String& key_system, |
266 const HeapVector<MediaKeySystemConfiguration>& supported_configurations) { | 267 const HeapVector<MediaKeySystemConfiguration>& supported_configurations) { |
267 DVLOG(3) << __func__; | 268 DVLOG(3) << __func__; |
268 | 269 |
269 ExecutionContext* execution_context = script_state->GetExecutionContext(); | 270 ExecutionContext* execution_context = ExecutionContext::From(script_state); |
270 Document* document = ToDocument(execution_context); | 271 Document* document = ToDocument(execution_context); |
271 | 272 |
272 // From https://w3c.github.io/encrypted-media/#common-key-systems | 273 // From https://w3c.github.io/encrypted-media/#common-key-systems |
273 // All user agents MUST support the common key systems described in this | 274 // All user agents MUST support the common key systems described in this |
274 // section. | 275 // section. |
275 // 9.1 Clear Key: The "org.w3.clearkey" Key System uses plain-text clear | 276 // 9.1 Clear Key: The "org.w3.clearkey" Key System uses plain-text clear |
276 // (unencrypted) key(s) to decrypt the source. | 277 // (unencrypted) key(s) to decrypt the source. |
277 // | 278 // |
278 // Do not check settings for Clear Key. | 279 // Do not check settings for Clear Key. |
279 if (key_system != "org.w3.clearkey") { | 280 if (key_system != "org.w3.clearkey") { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 WebEncryptedMediaClient* media_client = | 333 WebEncryptedMediaClient* media_client = |
333 controller->EncryptedMediaClient(execution_context); | 334 controller->EncryptedMediaClient(execution_context); |
334 media_client->RequestMediaKeySystemAccess( | 335 media_client->RequestMediaKeySystemAccess( |
335 WebEncryptedMediaRequest(initializer)); | 336 WebEncryptedMediaRequest(initializer)); |
336 | 337 |
337 // 7. Return promise. | 338 // 7. Return promise. |
338 return promise; | 339 return promise; |
339 } | 340 } |
340 | 341 |
341 } // namespace blink | 342 } // namespace blink |
OLD | NEW |