| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 result[i] = EncryptedMediaUtils::convertToInitDataType(initDataTypes[i]); | 44 result[i] = EncryptedMediaUtils::convertToInitDataType(initDataTypes[i]); |
| 45 return result; | 45 return result; |
| 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, ParsedContentType::Mode::Strict); |
| 55 if (type.isValid()) { | 55 if (type.isValid()) { |
| 56 // From | 56 // From |
| 57 // http://w3c.github.io/encrypted-media/#get-supported-capabilities-for-au
dio-video-type | 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, | 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 | 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 | 60 // parameters, so only look up "codecs" if a single parameter is |
| 61 // present. Chromium expects "codecs" to be provided, so this capability | 61 // present. Chromium expects "codecs" to be provided, so this capability |
| 62 // will be skipped if codecs is not the only parameter specified. | 62 // will be skipped if codecs is not the only parameter specified. |
| 63 result[i].mimeType = type.mimeType(); | 63 result[i].mimeType = type.mimeType(); |
| 64 if (type.parameterCount() == 1u) | 64 if (type.parameterCount() == 1u) |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 WebEncryptedMediaClient* mediaClient = | 331 WebEncryptedMediaClient* mediaClient = |
| 332 controller->encryptedMediaClient(executionContext); | 332 controller->encryptedMediaClient(executionContext); |
| 333 mediaClient->requestMediaKeySystemAccess( | 333 mediaClient->requestMediaKeySystemAccess( |
| 334 WebEncryptedMediaRequest(initializer)); | 334 WebEncryptedMediaRequest(initializer)); |
| 335 | 335 |
| 336 // 7. Return promise. | 336 // 7. Return promise. |
| 337 return promise; | 337 return promise; |
| 338 } | 338 } |
| 339 | 339 |
| 340 } // namespace blink | 340 } // namespace blink |
| OLD | NEW |