| 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 12 matching lines...) Expand all Loading... |
| 23 #include "platform/Histogram.h" | 23 #include "platform/Histogram.h" |
| 24 #include "platform/bindings/ScriptState.h" | 24 #include "platform/bindings/ScriptState.h" |
| 25 #include "platform/bindings/V8ThrowException.h" | 25 #include "platform/bindings/V8ThrowException.h" |
| 26 #include "platform/network/ParsedContentType.h" | 26 #include "platform/network/ParsedContentType.h" |
| 27 #include "platform/network/mime/ContentType.h" | 27 #include "platform/network/mime/ContentType.h" |
| 28 #include "platform/wtf/PtrUtil.h" | 28 #include "platform/wtf/PtrUtil.h" |
| 29 #include "platform/wtf/Vector.h" | 29 #include "platform/wtf/Vector.h" |
| 30 #include "platform/wtf/text/WTFString.h" | 30 #include "platform/wtf/text/WTFString.h" |
| 31 #include "public/platform/WebEncryptedMediaClient.h" | 31 #include "public/platform/WebEncryptedMediaClient.h" |
| 32 #include "public/platform/WebEncryptedMediaRequest.h" | 32 #include "public/platform/WebEncryptedMediaRequest.h" |
| 33 #include "public/platform/WebFeaturePolicyFeature.h" |
| 33 #include "public/platform/WebMediaKeySystemConfiguration.h" | 34 #include "public/platform/WebMediaKeySystemConfiguration.h" |
| 34 #include "public/platform/WebMediaKeySystemMediaCapability.h" | 35 #include "public/platform/WebMediaKeySystemMediaCapability.h" |
| 35 #include "public/platform/WebVector.h" | 36 #include "public/platform/WebVector.h" |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 static WebVector<WebEncryptedMediaInitDataType> ConvertInitDataTypes( | 42 static WebVector<WebEncryptedMediaInitDataType> ConvertInitDataTypes( |
| 42 const Vector<String>& init_data_types) { | 43 const Vector<String>& init_data_types) { |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 return ScriptPromise::RejectWithDOMException( | 324 return ScriptPromise::RejectWithDOMException( |
| 324 script_state, | 325 script_state, |
| 325 DOMException::Create( | 326 DOMException::Create( |
| 326 kInvalidStateError, | 327 kInvalidStateError, |
| 327 "The context provided is not associated with a page.")); | 328 "The context provided is not associated with a page.")); |
| 328 } | 329 } |
| 329 | 330 |
| 330 UseCounter::Count(*document, WebFeature::kEncryptedMediaSecureOrigin); | 331 UseCounter::Count(*document, WebFeature::kEncryptedMediaSecureOrigin); |
| 331 UseCounter::CountCrossOriginIframe( | 332 UseCounter::CountCrossOriginIframe( |
| 332 *document, WebFeature::kEncryptedMediaCrossOriginIframe); | 333 *document, WebFeature::kEncryptedMediaCrossOriginIframe); |
| 334 Deprecation::CountDeprecationFeaturePolicy(*document, |
| 335 WebFeaturePolicyFeature::kEme); |
| 333 | 336 |
| 334 // 4. Let origin be the origin of document. | 337 // 4. Let origin be the origin of document. |
| 335 // (Passed with the execution context.) | 338 // (Passed with the execution context.) |
| 336 | 339 |
| 337 // 5. Let promise be a new promise. | 340 // 5. Let promise be a new promise. |
| 338 MediaKeySystemAccessInitializer* initializer = | 341 MediaKeySystemAccessInitializer* initializer = |
| 339 new MediaKeySystemAccessInitializer(script_state, key_system, | 342 new MediaKeySystemAccessInitializer(script_state, key_system, |
| 340 supported_configurations); | 343 supported_configurations); |
| 341 ScriptPromise promise = initializer->Promise(); | 344 ScriptPromise promise = initializer->Promise(); |
| 342 | 345 |
| 343 // 6. Asynchronously determine support, and if allowed, create and | 346 // 6. Asynchronously determine support, and if allowed, create and |
| 344 // initialize the MediaKeySystemAccess object. | 347 // initialize the MediaKeySystemAccess object. |
| 345 MediaKeysController* controller = | 348 MediaKeysController* controller = |
| 346 MediaKeysController::From(document->GetPage()); | 349 MediaKeysController::From(document->GetPage()); |
| 347 WebEncryptedMediaClient* media_client = | 350 WebEncryptedMediaClient* media_client = |
| 348 controller->EncryptedMediaClient(execution_context); | 351 controller->EncryptedMediaClient(execution_context); |
| 349 media_client->RequestMediaKeySystemAccess( | 352 media_client->RequestMediaKeySystemAccess( |
| 350 WebEncryptedMediaRequest(initializer)); | 353 WebEncryptedMediaRequest(initializer)); |
| 351 | 354 |
| 352 // 7. Return promise. | 355 // 7. Return promise. |
| 353 return promise; | 356 return promise; |
| 354 } | 357 } |
| 355 | 358 |
| 356 } // namespace blink | 359 } // namespace blink |
| OLD | NEW |