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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 // 2. If supportedConfigurations is empty, return a promise rejected with | 333 // 2. If supportedConfigurations is empty, return a promise rejected with |
334 // a newly created TypeError. | 334 // a newly created TypeError. |
335 if (!supportedConfigurations.size()) { | 335 if (!supportedConfigurations.size()) { |
336 return ScriptPromise::reject( | 336 return ScriptPromise::reject( |
337 scriptState, V8ThrowException::createTypeError( | 337 scriptState, V8ThrowException::createTypeError( |
338 scriptState->isolate(), | 338 scriptState->isolate(), |
339 "The supportedConfigurations parameter is empty.")); | 339 "The supportedConfigurations parameter is empty.")); |
340 } | 340 } |
341 | 341 |
342 // Note: This method should only be exposed to secure contexts as indicated | |
343 // by the [SecureContext] IDL attribute. Since that will break some existing | |
344 // sites, we simply keep track of sites that aren't secure and output a | |
345 // deprecation message. | |
346 if (executionContext->isSecureContext()) { | |
347 UseCounter::count(executionContext, UseCounter::EncryptedMediaSecureOrigin); | |
348 } else { | |
349 Deprecation::countDeprecation(executionContext, | |
350 UseCounter::EncryptedMediaInsecureOrigin); | |
351 // TODO(ddorwin): Implement the following: | |
352 // Reject promise with a new DOMException whose name is NotSupportedError. | |
353 } | |
354 | |
355 // 3. Let document be the calling context's Document. | 342 // 3. Let document be the calling context's Document. |
356 // (Done at the begining of this function.) | 343 // (Done at the begining of this function.) |
357 if (!document->page()) { | 344 if (!document->page()) { |
358 return ScriptPromise::rejectWithDOMException( | 345 return ScriptPromise::rejectWithDOMException( |
359 scriptState, | 346 scriptState, |
360 DOMException::create( | 347 DOMException::create( |
361 InvalidStateError, | 348 InvalidStateError, |
362 "The context provided is not associated with a page.")); | 349 "The context provided is not associated with a page.")); |
363 } | 350 } |
364 | 351 |
(...skipping 12 matching lines...) Expand all Loading... |
377 WebEncryptedMediaClient* mediaClient = | 364 WebEncryptedMediaClient* mediaClient = |
378 controller->encryptedMediaClient(executionContext); | 365 controller->encryptedMediaClient(executionContext); |
379 mediaClient->requestMediaKeySystemAccess( | 366 mediaClient->requestMediaKeySystemAccess( |
380 WebEncryptedMediaRequest(initializer)); | 367 WebEncryptedMediaRequest(initializer)); |
381 | 368 |
382 // 7. Return promise. | 369 // 7. Return promise. |
383 return promise; | 370 return promise; |
384 } | 371 } |
385 | 372 |
386 } // namespace blink | 373 } // namespace blink |
OLD | NEW |