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::IsSupportedKeySystemWithMediaMimeType( |
ddorwin
2015/01/27 00:51:51
Instead of adding a bool, the purpose of which is
jrummell
2015/02/03 00:40:49
Done.
| |
423 mime_type_ascii, strict_codecs, key_system_ascii)) { | 423 mime_type_ascii, strict_codecs, key_system_ascii, true)) { |
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. |
433 std::vector<std::string> strict_codecs; | 433 std::vector<std::string> strict_codecs; |
(...skipping 17 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 bool RendererBlinkPlatformImpl::MimeRegistry::supportsEncryptedMediaMIMEType( | 461 bool RendererBlinkPlatformImpl::MimeRegistry::supportsEncryptedMediaMIMEType( |
ddorwin
2015/01/27 00:51:51
This function is currently used by unprefixed EME,
jrummell
2015/02/03 00:40:49
Acknowledged.
| |
462 const WebString& key_system, | 462 const WebString& key_system, |
463 const WebString& mime_type, | 463 const WebString& mime_type, |
464 const WebString& codecs) { | 464 const WebString& codecs) { |
465 // Chromium only supports ASCII parameters. | 465 // Chromium only supports ASCII parameters. |
466 if (!base::IsStringASCII(key_system) || !base::IsStringASCII(mime_type) || | 466 if (!base::IsStringASCII(key_system) || !base::IsStringASCII(mime_type) || |
467 !base::IsStringASCII(codecs)) { | 467 !base::IsStringASCII(codecs)) { |
468 return false; | 468 return false; |
469 } | 469 } |
470 | 470 |
471 if (key_system.isEmpty()) | 471 if (key_system.isEmpty()) |
472 return false; | 472 return false; |
473 | 473 |
474 const std::string mime_type_ascii = base::UTF16ToASCII(mime_type); | 474 const std::string mime_type_ascii = base::UTF16ToASCII(mime_type); |
475 | 475 |
476 std::vector<std::string> codec_vector; | 476 std::vector<std::string> codec_vector; |
477 bool strip_suffix = !net::IsStrictMediaMimeType(mime_type_ascii); | 477 bool strip_suffix = !net::IsStrictMediaMimeType(mime_type_ascii); |
478 net::ParseCodecString(base::UTF16ToASCII(codecs), &codec_vector, | 478 net::ParseCodecString(base::UTF16ToASCII(codecs), &codec_vector, |
479 strip_suffix); | 479 strip_suffix); |
480 | 480 |
481 return media::IsSupportedKeySystemWithMediaMimeType( | 481 return media::IsSupportedKeySystemWithMediaMimeType( |
482 mime_type_ascii, codec_vector, base::UTF16ToASCII(key_system)); | 482 mime_type_ascii, codec_vector, base::UTF16ToASCII(key_system), true); |
ddorwin
2015/01/27 00:51:51
That makes true incorrect.
jrummell
2015/02/03 00:40:49
Done.
| |
483 } | 483 } |
484 | 484 |
485 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( | 485 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( |
486 const WebString& file_extension) { | 486 const WebString& file_extension) { |
487 if (IsPluginProcess()) | 487 if (IsPluginProcess()) |
488 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); | 488 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); |
489 | 489 |
490 // The sandbox restricts our access to the registry, so we need to proxy | 490 // The sandbox restricts our access to the registry, so we need to proxy |
491 // these calls over to the browser process. | 491 // these calls over to the browser process. |
492 std::string mime_type; | 492 std::string mime_type; |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1224 //------------------------------------------------------------------------------ | 1224 //------------------------------------------------------------------------------ |
1225 | 1225 |
1226 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1226 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
1227 const blink::WebBatteryStatus& status) { | 1227 const blink::WebBatteryStatus& status) { |
1228 if (!g_test_battery_status_listener) | 1228 if (!g_test_battery_status_listener) |
1229 return; | 1229 return; |
1230 g_test_battery_status_listener->updateBatteryStatus(status); | 1230 g_test_battery_status_listener->updateBatteryStatus(status); |
1231 } | 1231 } |
1232 | 1232 |
1233 } // namespace content | 1233 } // namespace content |
OLD | NEW |