Chromium Code Reviews| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 } | 46 } |
| 47 | 47 |
| 48 static WebVector<WebMediaKeySystemMediaCapability> convertCapabilities( | 48 static WebVector<WebMediaKeySystemMediaCapability> convertCapabilities( |
| 49 const HeapVector<MediaKeySystemMediaCapability>& capabilities) { | 49 const HeapVector<MediaKeySystemMediaCapability>& capabilities) { |
| 50 WebVector<WebMediaKeySystemMediaCapability> result(capabilities.size()); | 50 WebVector<WebMediaKeySystemMediaCapability> result(capabilities.size()); |
| 51 for (size_t i = 0; i < capabilities.size(); ++i) { | 51 for (size_t i = 0; i < capabilities.size(); ++i) { |
| 52 const WebString& contentType = capabilities[i].contentType(); | 52 const WebString& contentType = capabilities[i].contentType(); |
| 53 result[i].contentType = contentType; | 53 result[i].contentType = contentType; |
| 54 ParsedContentType type(contentType); | 54 ParsedContentType type(contentType); |
| 55 if (type.isValid()) { | 55 if (type.isValid()) { |
| 56 // FIXME: Fail if there are unrecognized parameters. | 56 // Fail if there are unrecognized parameters. There is no way to |
|
xhwang
2017/03/03 23:20:58
"Fail" isn't accurate since we just skip it..
xhwang
2017/03/03 23:20:58
Please quote the spec here:
"If the user agent do
jrummell
2017/03/04 00:48:25
Removed.
jrummell
2017/03/04 00:48:26
Done.
| |
| 57 // http://crbug.com/690131 | 57 // enumerate the parameters, so only look up "codecs" if a single |
| 58 // parameter is available. Chromium expects "codecs" to be valid, so | |
|
xhwang
2017/03/03 23:20:58
ooc, what if we have two "codecs" parameters?
jrummell
2017/03/04 00:48:25
ParsedContentType only returns the last one, so it
| |
| 59 // this capability will fail if codecs not the only parameter specified. | |
|
xhwang
2017/03/03 23:20:58
again, s/fail/skip, also s/not/is not/
jrummell
2017/03/04 00:48:25
Done.
| |
| 58 result[i].mimeType = type.mimeType(); | 60 result[i].mimeType = type.mimeType(); |
| 59 result[i].codecs = type.parameterValueForName("codecs"); | 61 if (type.parameterCount() == 1u) |
| 62 result[i].codecs = type.parameterValueForName("codecs"); | |
| 60 } | 63 } |
| 61 result[i].robustness = capabilities[i].robustness(); | 64 result[i].robustness = capabilities[i].robustness(); |
| 62 } | 65 } |
| 63 return result; | 66 return result; |
| 64 } | 67 } |
| 65 | 68 |
| 66 static WebMediaKeySystemConfiguration::Requirement convertMediaKeysRequirement( | 69 static WebMediaKeySystemConfiguration::Requirement convertMediaKeysRequirement( |
| 67 const String& requirement) { | 70 const String& requirement) { |
| 68 if (requirement == "required") | 71 if (requirement == "required") |
| 69 return WebMediaKeySystemConfiguration::Requirement::Required; | 72 return WebMediaKeySystemConfiguration::Requirement::Required; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 WebEncryptedMediaClient* mediaClient = | 328 WebEncryptedMediaClient* mediaClient = |
| 326 controller->encryptedMediaClient(executionContext); | 329 controller->encryptedMediaClient(executionContext); |
| 327 mediaClient->requestMediaKeySystemAccess( | 330 mediaClient->requestMediaKeySystemAccess( |
| 328 WebEncryptedMediaRequest(initializer)); | 331 WebEncryptedMediaRequest(initializer)); |
| 329 | 332 |
| 330 // 7. Return promise. | 333 // 7. Return promise. |
| 331 return promise; | 334 return promise; |
| 332 } | 335 } |
| 333 | 336 |
| 334 } // namespace blink | 337 } // namespace blink |
| OLD | NEW |