Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 1129643002: Moved media mime type and codec checks to media/base/mime_util.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback from ddorwin@ Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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"
79 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" 79 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h"
80 #include "third_party/WebKit/public/platform/WebURL.h" 80 #include "third_party/WebKit/public/platform/WebURL.h"
81 #include "third_party/WebKit/public/platform/WebVector.h" 81 #include "third_party/WebKit/public/platform/WebVector.h"
82 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionListener.h" 82 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionListener.h"
83 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationListener.h" 83 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationListener.h"
84 #include "ui/gfx/color_profile.h" 84 #include "ui/gfx/color_profile.h"
85 #include "url/gurl.h" 85 #include "url/gurl.h"
86 86
87 #if defined(OS_ANDROID) 87 #if defined(OS_ANDROID)
ddorwin 2015/05/09 02:12:02 #include "build/build_config.h"
servolk 2015/05/11 19:30:49 Done.
88 #include "content/renderer/android/synchronous_compositor_factory.h" 88 #include "content/renderer/android/synchronous_compositor_factory.h"
89 #include "content/renderer/media/android/audio_decoder_android.h" 89 #include "content/renderer/media/android/audio_decoder_android.h"
90 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" 90 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
91 #endif 91 #endif
92 92
93 #if defined(OS_MACOSX) 93 #if defined(OS_MACOSX)
94 #include "content/common/mac/font_descriptor.h" 94 #include "content/common/mac/font_descriptor.h"
95 #include "content/common/mac/font_loader.h" 95 #include "content/common/mac/font_loader.h"
96 #include "content/renderer/webscrollbarbehavior_impl_mac.h" 96 #include "content/renderer/webscrollbarbehavior_impl_mac.h"
97 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" 97 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698