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_webkitplatformsupport_impl.h" | 5 #include "content/renderer/renderer_webkitplatformsupport_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/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 if (!key_system.isEmpty()) { | 421 if (!key_system.isEmpty()) { |
422 // Check whether the key system is supported with the mime_type and codecs. | 422 // Check whether the key system is supported with the mime_type and codecs. |
423 | 423 |
424 // Chromium only supports ASCII parameters. | 424 // Chromium only supports ASCII parameters. |
425 if (!base::IsStringASCII(key_system)) | 425 if (!base::IsStringASCII(key_system)) |
426 return IsNotSupported; | 426 return IsNotSupported; |
427 | 427 |
428 std::string key_system_ascii = | 428 std::string key_system_ascii = |
429 GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); | 429 GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); |
430 std::vector<std::string> strict_codecs; | 430 std::vector<std::string> strict_codecs; |
431 bool strip_suffix = !net::IsStrictMediaMimeType(mime_type_ascii); | 431 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, true); |
432 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, strip_suffix); | |
433 | 432 |
434 if (!IsSupportedKeySystemWithMediaMimeType( | 433 if (!IsSupportedKeySystemWithMediaMimeType( |
435 mime_type_ascii, strict_codecs, key_system_ascii)) { | 434 mime_type_ascii, strict_codecs, key_system_ascii)) { |
436 return IsNotSupported; | 435 return IsNotSupported; |
437 } | 436 } |
438 | 437 |
439 // Continue processing the mime_type and codecs. | 438 // Continue processing the mime_type and codecs. |
440 } | 439 } |
441 | 440 |
442 // Check list of strict codecs to see if it is supported. | 441 // Check list of strict codecs to see if it is supported. |
443 if (net::IsStrictMediaMimeType(mime_type_ascii)) { | 442 if (net::IsStrictMediaMimeType(mime_type_ascii)) { |
444 // Check if the codecs are a perfect match. | 443 // Check if the codecs are a perfect match. |
445 std::vector<std::string> strict_codecs; | 444 std::vector<std::string> strict_codecs; |
446 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); | 445 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); |
447 if (net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)) | 446 return static_cast<WebMimeRegistry::SupportsType> ( |
448 return IsSupported; | 447 net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)); |
449 | |
450 // We support the container, but no codecs were specified. | |
451 if (codecs.isNull()) | |
452 return MayBeSupported; | |
453 | |
454 return IsNotSupported; | |
455 } | 448 } |
456 | 449 |
457 // If we don't recognize the codec, it's possible we support it. | 450 // If we don't recognize the codec, it's possible we support it. |
458 std::vector<std::string> parsed_codecs; | 451 std::vector<std::string> parsed_codecs; |
459 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); | 452 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); |
460 if (!net::AreSupportedMediaCodecs(parsed_codecs)) | 453 if (!net::AreSupportedMediaCodecs(parsed_codecs)) |
461 return MayBeSupported; | 454 return MayBeSupported; |
462 | 455 |
463 // Otherwise we have a perfect match. | 456 // Otherwise we have a perfect match. |
464 return IsSupported; | 457 return IsSupported; |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 battery_status_dispatcher_->SetListener(listener); | 1201 battery_status_dispatcher_->SetListener(listener); |
1209 } | 1202 } |
1210 | 1203 |
1211 // static | 1204 // static |
1212 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1205 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
1213 const blink::WebBatteryStatus& status) { | 1206 const blink::WebBatteryStatus& status) { |
1214 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1207 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
1215 } | 1208 } |
1216 | 1209 |
1217 } // namespace content | 1210 } // namespace content |
OLD | NEW |