Chromium Code Reviews| Index: Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp |
| diff --git a/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp b/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp |
| index 19ccc9615b9c347f5c9d31e84df8b96570543d50..fd51d97783a7b7261a8929c2d518985cd78cc582 100644 |
| --- a/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp |
| +++ b/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp |
| @@ -10,6 +10,7 @@ |
| #include "core/dom/DOMException.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/ExceptionCode.h" |
| +#include "core/frame/UseCounter.h" |
| #include "modules/encryptedmedia/EncryptedMediaUtils.h" |
| #include "modules/encryptedmedia/MediaKeySession.h" |
| #include "modules/encryptedmedia/MediaKeySystemAccess.h" |
| @@ -174,13 +175,22 @@ ScriptPromise NavigatorRequestMediaKeySystemAccess::requestMediaKeySystemAccess( |
| } |
| // 3-4. 'May Document use powerful features?' check. |
| - // FIXME: Implement 'May Document use powerful features?' check. |
| + ExecutionContext* executionContext = scriptState->executionContext(); |
| + Document* document = toDocument(executionContext); |
| + String errorMessage; |
| + if (document->isPrivilegedContext(errorMessage)) { |
|
philipj_slow
2015/05/06 07:39:43
isPriviledgedContext is on ExecutionContext, so th
ddorwin
2015/05/06 20:41:36
Done.
|
| + UseCounter::count(executionContext, UseCounter::EncryptedMediaSecureOrigin); |
| + } else { |
| + UseCounter::countDeprecation(executionContext, UseCounter::EncryptedMediaInsecureOrigin); |
| + // FIXME: Implement the following: |
|
philipj_slow
2015/05/06 07:39:43
The style recently changed, should now be TODO(ddo
ddorwin
2015/05/06 20:41:36
Done. Thanks.
|
| + // Reject promise with a new DOMException whose name is NotSupportedError. |
| + } |
| + |
| // 5. Let origin be the origin of document. |
| // (Passed with the execution context in step 7.) |
| // 6. Let promise be a new promise. |
| - Document* document = toDocument(scriptState->executionContext()); |
| if (!document->page()) { |
| return ScriptPromise::rejectWithDOMException( |
| scriptState, DOMException::create(InvalidStateError, "Document does not have a page.")); |
| @@ -192,7 +202,7 @@ ScriptPromise NavigatorRequestMediaKeySystemAccess::requestMediaKeySystemAccess( |
| // 7. Asynchronously determine support, and if allowed, create and |
| // initialize the MediaKeySystemAccess object. |
| MediaKeysController* controller = MediaKeysController::from(document->page()); |
| - WebEncryptedMediaClient* mediaClient = controller->encryptedMediaClient(scriptState->executionContext()); |
| + WebEncryptedMediaClient* mediaClient = controller->encryptedMediaClient(executionContext); |
| mediaClient->requestMediaKeySystemAccess(WebEncryptedMediaRequest(initializer)); |
| // 8. Return promise. |