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

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

Issue 877323009: Extracted media mime type checks from net/base/ into media/base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fixes #1 Created 5 years, 10 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "content/renderer/scheduler/webthread_impl_for_scheduler.h" 55 #include "content/renderer/scheduler/webthread_impl_for_scheduler.h"
56 #include "content/renderer/screen_orientation/screen_orientation_observer.h" 56 #include "content/renderer/screen_orientation/screen_orientation_observer.h"
57 #include "content/renderer/webclipboard_impl.h" 57 #include "content/renderer/webclipboard_impl.h"
58 #include "content/renderer/webgraphicscontext3d_provider_impl.h" 58 #include "content/renderer/webgraphicscontext3d_provider_impl.h"
59 #include "content/renderer/webpublicsuffixlist_impl.h" 59 #include "content/renderer/webpublicsuffixlist_impl.h"
60 #include "gpu/config/gpu_info.h" 60 #include "gpu/config/gpu_info.h"
61 #include "ipc/ipc_sync_message_filter.h" 61 #include "ipc/ipc_sync_message_filter.h"
62 #include "media/audio/audio_output_device.h" 62 #include "media/audio/audio_output_device.h"
63 #include "media/base/audio_hardware_config.h" 63 #include "media/base/audio_hardware_config.h"
64 #include "media/base/key_systems.h" 64 #include "media/base/key_systems.h"
65 #include "media/base/mime_util.h"
65 #include "media/blink/webcontentdecryptionmodule_impl.h" 66 #include "media/blink/webcontentdecryptionmodule_impl.h"
66 #include "media/filters/stream_parser_factory.h" 67 #include "media/filters/stream_parser_factory.h"
67 #include "net/base/mime_util.h"
68 #include "net/base/net_util.h" 68 #include "net/base/net_util.h"
69 #include "storage/common/quota/quota_types.h" 69 #include "storage/common/quota/quota_types.h"
70 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h" 70 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h"
71 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" 71 #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
72 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" 72 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
73 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h" 73 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h"
74 #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.h" 74 #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.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"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 //------------------------------------------------------------------------------ 403 //------------------------------------------------------------------------------
404 404
405 WebMimeRegistry::SupportsType 405 WebMimeRegistry::SupportsType
406 RendererBlinkPlatformImpl::MimeRegistry::supportsMediaMIMEType( 406 RendererBlinkPlatformImpl::MimeRegistry::supportsMediaMIMEType(
407 const WebString& mime_type, 407 const WebString& mime_type,
408 const WebString& codecs, 408 const WebString& codecs,
409 const WebString& key_system) { 409 const WebString& key_system) {
410 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); 410 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type);
411 // Not supporting the container is a flat-out no. 411 // Not supporting the container is a flat-out no.
412 if (!net::IsSupportedMediaMimeType(mime_type_ascii)) 412 if (!media::IsSupportedMediaMimeType(mime_type_ascii))
413 return IsNotSupported; 413 return IsNotSupported;
414 414
415 if (!key_system.isEmpty()) { 415 if (!key_system.isEmpty()) {
416 // Check whether the key system is supported with the mime_type and codecs. 416 // Check whether the key system is supported with the mime_type and codecs.
417 417
418 // Chromium only supports ASCII parameters. 418 // Chromium only supports ASCII parameters.
419 if (!base::IsStringASCII(key_system)) 419 if (!base::IsStringASCII(key_system))
420 return IsNotSupported; 420 return IsNotSupported;
421 421
422 std::string key_system_ascii = 422 std::string key_system_ascii =
423 media::GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); 423 media::GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system));
424 std::vector<std::string> strict_codecs; 424 std::vector<std::string> strict_codecs;
425 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, true); 425 media::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, true);
426 426
427 if (!media::PrefixedIsSupportedKeySystemWithMediaMimeType( 427 if (!media::PrefixedIsSupportedKeySystemWithMediaMimeType(
428 mime_type_ascii, strict_codecs, key_system_ascii)) { 428 mime_type_ascii, strict_codecs, key_system_ascii)) {
429 return IsNotSupported; 429 return IsNotSupported;
430 } 430 }
431 431
432 // Continue processing the mime_type and codecs. 432 // Continue processing the mime_type and codecs.
433 } 433 }
434 434
435 // Check list of strict codecs to see if it is supported. 435 // Check list of strict codecs to see if it is supported.
436 if (net::IsStrictMediaMimeType(mime_type_ascii)) { 436 if (media::IsStrictMediaMimeType(mime_type_ascii)) {
437 // Check if the codecs are a perfect match. 437 // Check if the codecs are a perfect match.
438 std::vector<std::string> strict_codecs; 438 std::vector<std::string> strict_codecs;
439 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); 439 media::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false);
440 return static_cast<WebMimeRegistry::SupportsType> ( 440 return static_cast<WebMimeRegistry::SupportsType> (
441 net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)); 441 media::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs));
442 } 442 }
443 443
444 // If we don't recognize the codec, it's possible we support it. 444 // If we don't recognize the codec, it's possible we support it.
445 std::vector<std::string> parsed_codecs; 445 std::vector<std::string> parsed_codecs;
446 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); 446 media::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true);
447 if (!net::AreSupportedMediaCodecs(parsed_codecs)) 447 if (!media::AreSupportedMediaCodecs(parsed_codecs))
448 return MayBeSupported; 448 return MayBeSupported;
449 449
450 // Otherwise we have a perfect match. 450 // Otherwise we have a perfect match.
451 return IsSupported; 451 return IsSupported;
452 } 452 }
453 453
454 bool RendererBlinkPlatformImpl::MimeRegistry::supportsMediaSourceMIMEType( 454 bool RendererBlinkPlatformImpl::MimeRegistry::supportsMediaSourceMIMEType(
455 const blink::WebString& mime_type, 455 const blink::WebString& mime_type,
456 const WebString& codecs) { 456 const WebString& codecs) {
457 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); 457 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type);
458 std::vector<std::string> parsed_codec_ids; 458 std::vector<std::string> parsed_codec_ids;
459 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false); 459 media::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false);
460 if (mime_type_ascii.empty()) 460 if (mime_type_ascii.empty())
461 return false; 461 return false;
462 return media::StreamParserFactory::IsTypeSupported( 462 return media::StreamParserFactory::IsTypeSupported(
463 mime_type_ascii, parsed_codec_ids); 463 mime_type_ascii, parsed_codec_ids);
464 } 464 }
465 465
466 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( 466 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension(
467 const WebString& file_extension) { 467 const WebString& file_extension) {
468 if (IsPluginProcess()) 468 if (IsPluginProcess())
469 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); 469 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension);
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 //------------------------------------------------------------------------------ 1221 //------------------------------------------------------------------------------
1222 1222
1223 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( 1223 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting(
1224 const blink::WebBatteryStatus& status) { 1224 const blink::WebBatteryStatus& status) {
1225 if (!g_test_battery_status_listener) 1225 if (!g_test_battery_status_listener)
1226 return; 1226 return;
1227 g_test_battery_status_listener->updateBatteryStatus(status); 1227 g_test_battery_status_listener->updateBatteryStatus(status);
1228 } 1228 }
1229 1229
1230 } // namespace content 1230 } // namespace content
OLDNEW
« no previous file with comments | « content/content_common.gypi ('k') | content/shell/DEPS » ('j') | net/base/mime_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698