| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 if (!key_system.isEmpty()) { | 417 if (!key_system.isEmpty()) { |
| 418 // Check whether the key system is supported with the mime_type and codecs. | 418 // Check whether the key system is supported with the mime_type and codecs. |
| 419 | 419 |
| 420 // Chromium only supports ASCII parameters. | 420 // Chromium only supports ASCII parameters. |
| 421 if (!base::IsStringASCII(key_system)) | 421 if (!base::IsStringASCII(key_system)) |
| 422 return IsNotSupported; | 422 return IsNotSupported; |
| 423 | 423 |
| 424 std::string key_system_ascii = | 424 std::string key_system_ascii = |
| 425 GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); | 425 GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); |
| 426 std::vector<std::string> strict_codecs; | 426 std::vector<std::string> strict_codecs; |
| 427 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, true); | 427 bool strip_suffix = !net::IsStrictMediaMimeType(mime_type_ascii); |
| 428 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, strip_suffix); |
| 428 | 429 |
| 429 if (!IsSupportedKeySystemWithMediaMimeType( | 430 if (!IsSupportedKeySystemWithMediaMimeType( |
| 430 mime_type_ascii, strict_codecs, key_system_ascii)) { | 431 mime_type_ascii, strict_codecs, key_system_ascii)) { |
| 431 return IsNotSupported; | 432 return IsNotSupported; |
| 432 } | 433 } |
| 433 | 434 |
| 434 // Continue processing the mime_type and codecs. | 435 // Continue processing the mime_type and codecs. |
| 435 } | 436 } |
| 436 | 437 |
| 437 // Check list of strict codecs to see if it is supported. | 438 // Check list of strict codecs to see if it is supported. |
| 438 if (net::IsStrictMediaMimeType(mime_type_ascii)) { | 439 if (net::IsStrictMediaMimeType(mime_type_ascii)) { |
| 439 // Check if the codecs are a perfect match. | 440 // Check if the codecs are a perfect match. |
| 440 std::vector<std::string> strict_codecs; | 441 std::vector<std::string> strict_codecs; |
| 441 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); | 442 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); |
| 442 return static_cast<WebMimeRegistry::SupportsType> ( | 443 if (net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)) |
| 443 net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)); | 444 return IsSupported; |
| 445 |
| 446 // We support the container, but no codecs were specified. |
| 447 if (codecs.isNull()) |
| 448 return MayBeSupported; |
| 449 |
| 450 return IsNotSupported; |
| 444 } | 451 } |
| 445 | 452 |
| 446 // If we don't recognize the codec, it's possible we support it. | 453 // If we don't recognize the codec, it's possible we support it. |
| 447 std::vector<std::string> parsed_codecs; | 454 std::vector<std::string> parsed_codecs; |
| 448 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); | 455 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); |
| 449 if (!net::AreSupportedMediaCodecs(parsed_codecs)) | 456 if (!net::AreSupportedMediaCodecs(parsed_codecs)) |
| 450 return MayBeSupported; | 457 return MayBeSupported; |
| 451 | 458 |
| 452 // Otherwise we have a perfect match. | 459 // Otherwise we have a perfect match. |
| 453 return IsSupported; | 460 return IsSupported; |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 battery_status_dispatcher_->SetListener(listener); | 1142 battery_status_dispatcher_->SetListener(listener); |
| 1136 } | 1143 } |
| 1137 | 1144 |
| 1138 // static | 1145 // static |
| 1139 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1146 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
| 1140 const blink::WebBatteryStatus& status) { | 1147 const blink::WebBatteryStatus& status) { |
| 1141 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1148 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
| 1142 } | 1149 } |
| 1143 | 1150 |
| 1144 } // namespace content | 1151 } // namespace content |
| OLD | NEW |