Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp

Issue 2567173002: Clean up Document::isSecureContext (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
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 "bindings/core/v8/V8ThrowException.h" 10 #include "bindings/core/v8/V8ThrowException.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 scriptState, V8ThrowException::createTypeError( 348 scriptState, V8ThrowException::createTypeError(
349 scriptState->isolate(), 349 scriptState->isolate(),
350 "The supportedConfigurations parameter is empty.")); 350 "The supportedConfigurations parameter is empty."));
351 } 351 }
352 352
353 // Note: This method should only be exposed to secure contexts as indicated 353 // Note: This method should only be exposed to secure contexts as indicated
354 // by the [SecureContext] IDL attribute. Since that will break some existing 354 // by the [SecureContext] IDL attribute. Since that will break some existing
355 // sites, we simply keep track of sites that aren't secure and output a 355 // sites, we simply keep track of sites that aren't secure and output a
356 // deprecation message. 356 // deprecation message.
357 ExecutionContext* executionContext = scriptState->getExecutionContext(); 357 ExecutionContext* executionContext = scriptState->getExecutionContext();
358 String errorMessage; 358 if (executionContext->isSecureContext()) {
359 if (executionContext->isSecureContext(errorMessage)) {
360 UseCounter::count(executionContext, UseCounter::EncryptedMediaSecureOrigin); 359 UseCounter::count(executionContext, UseCounter::EncryptedMediaSecureOrigin);
361 } else { 360 } else {
362 Deprecation::countDeprecation(executionContext, 361 Deprecation::countDeprecation(executionContext,
363 UseCounter::EncryptedMediaInsecureOrigin); 362 UseCounter::EncryptedMediaInsecureOrigin);
364 // TODO(ddorwin): Implement the following: 363 // TODO(ddorwin): Implement the following:
365 // Reject promise with a new DOMException whose name is NotSupportedError. 364 // Reject promise with a new DOMException whose name is NotSupportedError.
366 } 365 }
367 366
368 // 3. Let document be the calling context's Document. 367 // 3. Let document be the calling context's Document.
369 Document* document = toDocument(executionContext); 368 Document* document = toDocument(executionContext);
(...skipping 20 matching lines...) Expand all
390 WebEncryptedMediaClient* mediaClient = 389 WebEncryptedMediaClient* mediaClient =
391 controller->encryptedMediaClient(executionContext); 390 controller->encryptedMediaClient(executionContext);
392 mediaClient->requestMediaKeySystemAccess( 391 mediaClient->requestMediaKeySystemAccess(
393 WebEncryptedMediaRequest(initializer)); 392 WebEncryptedMediaRequest(initializer));
394 393
395 // 7. Return promise. 394 // 7. Return promise.
396 return promise; 395 return promise;
397 } 396 }
398 397
399 } // namespace blink 398 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698