| 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 // From |
| 57 // http://crbug.com/690131 | 57 // http://w3c.github.io/encrypted-media/#get-supported-capabilities-for-au
dio-video-type |
| 58 // "If the user agent does not recognize one or more parameters, |
| 59 // continue to the next iteration." There is no way to enumerate the |
| 60 // parameters, so only look up "codecs" if a single parameter is |
| 61 // present. Chromium expects "codecs" to be provided, so this capability |
| 62 // will be skipped if codecs is not the only parameter specified. |
| 58 result[i].mimeType = type.mimeType(); | 63 result[i].mimeType = type.mimeType(); |
| 59 result[i].codecs = type.parameterValueForName("codecs"); | 64 if (type.parameterCount() == 1u) |
| 65 result[i].codecs = type.parameterValueForName("codecs"); |
| 60 } | 66 } |
| 61 result[i].robustness = capabilities[i].robustness(); | 67 result[i].robustness = capabilities[i].robustness(); |
| 62 } | 68 } |
| 63 return result; | 69 return result; |
| 64 } | 70 } |
| 65 | 71 |
| 66 static WebMediaKeySystemConfiguration::Requirement convertMediaKeysRequirement( | 72 static WebMediaKeySystemConfiguration::Requirement convertMediaKeysRequirement( |
| 67 const String& requirement) { | 73 const String& requirement) { |
| 68 if (requirement == "required") | 74 if (requirement == "required") |
| 69 return WebMediaKeySystemConfiguration::Requirement::Required; | 75 return WebMediaKeySystemConfiguration::Requirement::Required; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 WebEncryptedMediaClient* mediaClient = | 331 WebEncryptedMediaClient* mediaClient = |
| 326 controller->encryptedMediaClient(executionContext); | 332 controller->encryptedMediaClient(executionContext); |
| 327 mediaClient->requestMediaKeySystemAccess( | 333 mediaClient->requestMediaKeySystemAccess( |
| 328 WebEncryptedMediaRequest(initializer)); | 334 WebEncryptedMediaRequest(initializer)); |
| 329 | 335 |
| 330 // 7. Return promise. | 336 // 7. Return promise. |
| 331 return promise; | 337 return promise; |
| 332 } | 338 } |
| 333 | 339 |
| 334 } // namespace blink | 340 } // namespace blink |
| OLD | NEW |