OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/renderer_blink_platform_impl.h" | 5 #include "content/renderer/renderer_blink_platform_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 412 |
413 // Chromium only supports ASCII parameters. | 413 // Chromium only supports ASCII parameters. |
414 if (!base::IsStringASCII(key_system)) | 414 if (!base::IsStringASCII(key_system)) |
415 return IsNotSupported; | 415 return IsNotSupported; |
416 | 416 |
417 std::string key_system_ascii = | 417 std::string key_system_ascii = |
418 media::GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); | 418 media::GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); |
419 std::vector<std::string> strict_codecs; | 419 std::vector<std::string> strict_codecs; |
420 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, true); | 420 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, true); |
421 | 421 |
422 if (!media::IsSupportedKeySystemWithMediaMimeType( | 422 if (!media::PrefixedIsSupportedKeySystemWithMediaMimeType( |
423 mime_type_ascii, strict_codecs, key_system_ascii)) { | 423 mime_type_ascii, strict_codecs, key_system_ascii)) { |
424 return IsNotSupported; | 424 return IsNotSupported; |
425 } | 425 } |
426 | 426 |
427 // Continue processing the mime_type and codecs. | 427 // Continue processing the mime_type and codecs. |
428 } | 428 } |
429 | 429 |
430 // Check list of strict codecs to see if it is supported. | 430 // Check list of strict codecs to see if it is supported. |
431 if (net::IsStrictMediaMimeType(mime_type_ascii)) { | 431 if (net::IsStrictMediaMimeType(mime_type_ascii)) { |
432 // Check if the codecs are a perfect match. | 432 // Check if the codecs are a perfect match. |
(...skipping 18 matching lines...) Expand all Loading... |
451 const WebString& codecs) { | 451 const WebString& codecs) { |
452 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); | 452 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); |
453 std::vector<std::string> parsed_codec_ids; | 453 std::vector<std::string> parsed_codec_ids; |
454 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false); | 454 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false); |
455 if (mime_type_ascii.empty()) | 455 if (mime_type_ascii.empty()) |
456 return false; | 456 return false; |
457 return media::StreamParserFactory::IsTypeSupported( | 457 return media::StreamParserFactory::IsTypeSupported( |
458 mime_type_ascii, parsed_codec_ids); | 458 mime_type_ascii, parsed_codec_ids); |
459 } | 459 } |
460 | 460 |
| 461 // TODO(jrummell): This method is only used by unprefixed EME, and should not |
| 462 // be called when http://crbug.com/385874 is fixed. Remove this method once |
| 463 // that happens. |
461 bool RendererBlinkPlatformImpl::MimeRegistry::supportsEncryptedMediaMIMEType( | 464 bool RendererBlinkPlatformImpl::MimeRegistry::supportsEncryptedMediaMIMEType( |
462 const WebString& key_system, | 465 const WebString& key_system, |
463 const WebString& mime_type, | 466 const WebString& mime_type, |
464 const WebString& codecs) { | 467 const WebString& codecs) { |
465 // Chromium only supports ASCII parameters. | 468 // Chromium only supports ASCII parameters. |
466 if (!base::IsStringASCII(key_system) || !base::IsStringASCII(mime_type) || | 469 if (!base::IsStringASCII(key_system) || !base::IsStringASCII(mime_type) || |
467 !base::IsStringASCII(codecs)) { | 470 !base::IsStringASCII(codecs)) { |
468 return false; | 471 return false; |
469 } | 472 } |
470 | 473 |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 //------------------------------------------------------------------------------ | 1227 //------------------------------------------------------------------------------ |
1225 | 1228 |
1226 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1229 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
1227 const blink::WebBatteryStatus& status) { | 1230 const blink::WebBatteryStatus& status) { |
1228 if (!g_test_battery_status_listener) | 1231 if (!g_test_battery_status_listener) |
1229 return; | 1232 return; |
1230 g_test_battery_status_listener->updateBatteryStatus(status); | 1233 g_test_battery_status_listener->updateBatteryStatus(status); |
1231 } | 1234 } |
1232 | 1235 |
1233 } // namespace content | 1236 } // namespace content |
OLD | NEW |