| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "content/renderer/renderer_clipboard_delegate.h" | 56 #include "content/renderer/renderer_clipboard_delegate.h" |
| 57 #include "content/renderer/screen_orientation/screen_orientation_observer.h" | 57 #include "content/renderer/screen_orientation/screen_orientation_observer.h" |
| 58 #include "content/renderer/webclipboard_impl.h" | 58 #include "content/renderer/webclipboard_impl.h" |
| 59 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 59 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
| 60 #include "content/renderer/webpublicsuffixlist_impl.h" | 60 #include "content/renderer/webpublicsuffixlist_impl.h" |
| 61 #include "gpu/config/gpu_info.h" | 61 #include "gpu/config/gpu_info.h" |
| 62 #include "ipc/ipc_sync_message_filter.h" | 62 #include "ipc/ipc_sync_message_filter.h" |
| 63 #include "media/audio/audio_output_device.h" | 63 #include "media/audio/audio_output_device.h" |
| 64 #include "media/base/audio_hardware_config.h" | 64 #include "media/base/audio_hardware_config.h" |
| 65 #include "media/base/key_systems.h" | 65 #include "media/base/key_systems.h" |
| 66 #include "media/base/mime_util.h" |
| 66 #include "media/blink/webcontentdecryptionmodule_impl.h" | 67 #include "media/blink/webcontentdecryptionmodule_impl.h" |
| 67 #include "media/filters/stream_parser_factory.h" | 68 #include "media/filters/stream_parser_factory.h" |
| 68 #include "net/base/mime_util.h" | |
| 69 #include "net/base/net_util.h" | 69 #include "net/base/net_util.h" |
| 70 #include "storage/common/database/database_identifier.h" | 70 #include "storage/common/database/database_identifier.h" |
| 71 #include "storage/common/quota/quota_types.h" | 71 #include "storage/common/quota/quota_types.h" |
| 72 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h" | 72 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h" |
| 73 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 73 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" |
| 74 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" | 74 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" |
| 75 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 75 #include "third_party/WebKit/public/platform/WebFileInfo.h" |
| 76 #include "third_party/WebKit/public/platform/WebGamepads.h" | 76 #include "third_party/WebKit/public/platform/WebGamepads.h" |
| 77 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 77 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
| 78 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 78 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 405 |
| 406 //------------------------------------------------------------------------------ | 406 //------------------------------------------------------------------------------ |
| 407 | 407 |
| 408 WebMimeRegistry::SupportsType | 408 WebMimeRegistry::SupportsType |
| 409 RendererBlinkPlatformImpl::MimeRegistry::supportsMediaMIMEType( | 409 RendererBlinkPlatformImpl::MimeRegistry::supportsMediaMIMEType( |
| 410 const WebString& mime_type, | 410 const WebString& mime_type, |
| 411 const WebString& codecs, | 411 const WebString& codecs, |
| 412 const WebString& key_system) { | 412 const WebString& key_system) { |
| 413 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); | 413 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); |
| 414 // Not supporting the container is a flat-out no. | 414 // Not supporting the container is a flat-out no. |
| 415 if (!net::IsSupportedMediaMimeType(mime_type_ascii)) | 415 if (!media::IsSupportedMediaMimeType(mime_type_ascii)) |
| 416 return IsNotSupported; | 416 return IsNotSupported; |
| 417 | 417 |
| 418 if (!key_system.isEmpty()) { | 418 if (!key_system.isEmpty()) { |
| 419 // Check whether the key system is supported with the mime_type and codecs. | 419 // Check whether the key system is supported with the mime_type and codecs. |
| 420 | 420 |
| 421 // Chromium only supports ASCII parameters. | 421 // Chromium only supports ASCII parameters. |
| 422 if (!base::IsStringASCII(key_system)) | 422 if (!base::IsStringASCII(key_system)) |
| 423 return IsNotSupported; | 423 return IsNotSupported; |
| 424 | 424 |
| 425 std::string key_system_ascii = | 425 std::string key_system_ascii = |
| 426 media::GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); | 426 media::GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); |
| 427 std::vector<std::string> strict_codecs; | 427 std::vector<std::string> strict_codecs; |
| 428 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, true); | 428 media::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, true); |
| 429 | 429 |
| 430 if (!media::PrefixedIsSupportedKeySystemWithMediaMimeType( | 430 if (!media::PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 431 mime_type_ascii, strict_codecs, key_system_ascii)) { | 431 mime_type_ascii, strict_codecs, key_system_ascii)) { |
| 432 return IsNotSupported; | 432 return IsNotSupported; |
| 433 } | 433 } |
| 434 | 434 |
| 435 // Continue processing the mime_type and codecs. | 435 // Continue processing the mime_type and codecs. |
| 436 } | 436 } |
| 437 | 437 |
| 438 // Check list of strict codecs to see if it is supported. | 438 // Check list of strict codecs to see if it is supported. |
| 439 if (net::IsStrictMediaMimeType(mime_type_ascii)) { | 439 if (media::IsStrictMediaMimeType(mime_type_ascii)) { |
| 440 // Check if the codecs are a perfect match. | 440 // Check if the codecs are a perfect match. |
| 441 std::vector<std::string> strict_codecs; | 441 std::vector<std::string> strict_codecs; |
| 442 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); | 442 media::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); |
| 443 return static_cast<WebMimeRegistry::SupportsType> ( | 443 return static_cast<WebMimeRegistry::SupportsType> ( |
| 444 net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)); | 444 media::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)); |
| 445 } | 445 } |
| 446 | 446 |
| 447 // If we don't recognize the codec, it's possible we support it. | 447 // If we don't recognize the codec, it's possible we support it. |
| 448 std::vector<std::string> parsed_codecs; | 448 std::vector<std::string> parsed_codecs; |
| 449 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); | 449 media::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); |
| 450 if (!net::AreSupportedMediaCodecs(parsed_codecs)) | 450 if (!media::AreSupportedMediaCodecs(parsed_codecs)) |
| 451 return MayBeSupported; | 451 return MayBeSupported; |
| 452 | 452 |
| 453 // Otherwise we have a perfect match. | 453 // Otherwise we have a perfect match. |
| 454 return IsSupported; | 454 return IsSupported; |
| 455 } | 455 } |
| 456 | 456 |
| 457 bool RendererBlinkPlatformImpl::MimeRegistry::supportsMediaSourceMIMEType( | 457 bool RendererBlinkPlatformImpl::MimeRegistry::supportsMediaSourceMIMEType( |
| 458 const blink::WebString& mime_type, | 458 const blink::WebString& mime_type, |
| 459 const WebString& codecs) { | 459 const WebString& codecs) { |
| 460 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); | 460 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); |
| 461 std::vector<std::string> parsed_codec_ids; | 461 std::vector<std::string> parsed_codec_ids; |
| 462 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false); | 462 media::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false); |
| 463 if (mime_type_ascii.empty()) | 463 if (mime_type_ascii.empty()) |
| 464 return false; | 464 return false; |
| 465 return media::StreamParserFactory::IsTypeSupported( | 465 return media::StreamParserFactory::IsTypeSupported( |
| 466 mime_type_ascii, parsed_codec_ids); | 466 mime_type_ascii, parsed_codec_ids); |
| 467 } | 467 } |
| 468 | 468 |
| 469 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( | 469 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( |
| 470 const WebString& file_extension) { | 470 const WebString& file_extension) { |
| 471 if (IsPluginProcess()) | 471 if (IsPluginProcess()) |
| 472 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); | 472 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 //------------------------------------------------------------------------------ | 1227 //------------------------------------------------------------------------------ |
| 1228 | 1228 |
| 1229 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1229 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
| 1230 const blink::WebBatteryStatus& status) { | 1230 const blink::WebBatteryStatus& status) { |
| 1231 if (!g_test_battery_status_listener) | 1231 if (!g_test_battery_status_listener) |
| 1232 return; | 1232 return; |
| 1233 g_test_battery_status_listener->updateBatteryStatus(status); | 1233 g_test_battery_status_listener->updateBatteryStatus(status); |
| 1234 } | 1234 } |
| 1235 | 1235 |
| 1236 } // namespace content | 1236 } // namespace content |
| OLD | NEW |