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 "config.h" | 5 #include "config.h" |
6 #include "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" | 6 #include "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" |
7 | 7 |
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 "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // promise rejected with a new DOMException whose name is | 177 // promise rejected with a new DOMException whose name is |
178 // InvalidAccessError. | 178 // InvalidAccessError. |
179 if (!supportedConfigurations.size()) { | 179 if (!supportedConfigurations.size()) { |
180 return ScriptPromise::rejectWithDOMException( | 180 return ScriptPromise::rejectWithDOMException( |
181 scriptState, DOMException::create(InvalidAccessError, "The supported
Configurations parameter is empty.")); | 181 scriptState, DOMException::create(InvalidAccessError, "The supported
Configurations parameter is empty.")); |
182 } | 182 } |
183 | 183 |
184 // 3-4. 'May Document use powerful features?' check. | 184 // 3-4. 'May Document use powerful features?' check. |
185 ExecutionContext* executionContext = scriptState->executionContext(); | 185 ExecutionContext* executionContext = scriptState->executionContext(); |
186 String errorMessage; | 186 String errorMessage; |
187 if (executionContext->isPrivilegedContext(errorMessage)) { | 187 if (executionContext->isSecureContext(errorMessage)) { |
188 UseCounter::count(executionContext, UseCounter::EncryptedMediaSecureOrig
in); | 188 UseCounter::count(executionContext, UseCounter::EncryptedMediaSecureOrig
in); |
189 } else { | 189 } else { |
190 UseCounter::countDeprecation(executionContext, UseCounter::EncryptedMedi
aInsecureOrigin); | 190 UseCounter::countDeprecation(executionContext, UseCounter::EncryptedMedi
aInsecureOrigin); |
191 // TODO(ddorwin): Implement the following: | 191 // TODO(ddorwin): Implement the following: |
192 // Reject promise with a new DOMException whose name is NotSupportedErro
r. | 192 // Reject promise with a new DOMException whose name is NotSupportedErro
r. |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 // 5. Let origin be the origin of document. | 196 // 5. Let origin be the origin of document. |
197 // (Passed with the execution context in step 7.) | 197 // (Passed with the execution context in step 7.) |
(...skipping 12 matching lines...) Expand all Loading... |
210 // initialize the MediaKeySystemAccess object. | 210 // initialize the MediaKeySystemAccess object. |
211 MediaKeysController* controller = MediaKeysController::from(document->page()
); | 211 MediaKeysController* controller = MediaKeysController::from(document->page()
); |
212 WebEncryptedMediaClient* mediaClient = controller->encryptedMediaClient(exec
utionContext); | 212 WebEncryptedMediaClient* mediaClient = controller->encryptedMediaClient(exec
utionContext); |
213 mediaClient->requestMediaKeySystemAccess(WebEncryptedMediaRequest(initialize
r)); | 213 mediaClient->requestMediaKeySystemAccess(WebEncryptedMediaRequest(initialize
r)); |
214 | 214 |
215 // 8. Return promise. | 215 // 8. Return promise. |
216 return promise; | 216 return promise; |
217 } | 217 } |
218 | 218 |
219 } // namespace blink | 219 } // namespace blink |
OLD | NEW |