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

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

Issue 1123343007: iOS experiments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added media_blink dependency on media_mime_util 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
« no previous file with comments | « content/child/assert_matching_enums.cc ('k') | content/shell/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/memory/shared_memory.h" 11 #include "base/memory/shared_memory.h"
12 #include "base/message_loop/message_loop_proxy.h" 12 #include "base/message_loop/message_loop_proxy.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/numerics/safe_conversions.h" 14 #include "base/numerics/safe_conversions.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "build/build_config.h"
17 #include "cc/blink/context_provider_web_context.h" 18 #include "cc/blink/context_provider_web_context.h"
18 #include "components/scheduler/child/web_scheduler_impl.h" 19 #include "components/scheduler/child/web_scheduler_impl.h"
19 #include "components/scheduler/renderer/renderer_scheduler.h" 20 #include "components/scheduler/renderer/renderer_scheduler.h"
20 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" 21 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h"
21 #include "content/child/database_util.h" 22 #include "content/child/database_util.h"
22 #include "content/child/file_info_util.h" 23 #include "content/child/file_info_util.h"
23 #include "content/child/fileapi/webfilesystem_impl.h" 24 #include "content/child/fileapi/webfilesystem_impl.h"
24 #include "content/child/indexed_db/webidbfactory_impl.h" 25 #include "content/child/indexed_db/webidbfactory_impl.h"
25 #include "content/child/npapi/npobject_util.h" 26 #include "content/child/npapi/npobject_util.h"
26 #include "content/child/quota_dispatcher.h" 27 #include "content/child/quota_dispatcher.h"
(...skipping 29 matching lines...) Expand all
56 #include "content/renderer/renderer_clipboard_delegate.h" 57 #include "content/renderer/renderer_clipboard_delegate.h"
57 #include "content/renderer/screen_orientation/screen_orientation_observer.h" 58 #include "content/renderer/screen_orientation/screen_orientation_observer.h"
58 #include "content/renderer/webclipboard_impl.h" 59 #include "content/renderer/webclipboard_impl.h"
59 #include "content/renderer/webgraphicscontext3d_provider_impl.h" 60 #include "content/renderer/webgraphicscontext3d_provider_impl.h"
60 #include "content/renderer/webpublicsuffixlist_impl.h" 61 #include "content/renderer/webpublicsuffixlist_impl.h"
61 #include "gpu/config/gpu_info.h" 62 #include "gpu/config/gpu_info.h"
62 #include "ipc/ipc_sync_message_filter.h" 63 #include "ipc/ipc_sync_message_filter.h"
63 #include "media/audio/audio_output_device.h" 64 #include "media/audio/audio_output_device.h"
64 #include "media/base/audio_hardware_config.h" 65 #include "media/base/audio_hardware_config.h"
65 #include "media/base/key_systems.h" 66 #include "media/base/key_systems.h"
67 #include "media/base/mime_util.h"
66 #include "media/blink/webcontentdecryptionmodule_impl.h" 68 #include "media/blink/webcontentdecryptionmodule_impl.h"
67 #include "media/filters/stream_parser_factory.h" 69 #include "media/filters/stream_parser_factory.h"
68 #include "net/base/mime_util.h"
69 #include "net/base/net_util.h" 70 #include "net/base/net_util.h"
70 #include "storage/common/database/database_identifier.h" 71 #include "storage/common/database/database_identifier.h"
71 #include "storage/common/quota/quota_types.h" 72 #include "storage/common/quota/quota_types.h"
72 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h" 73 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h"
73 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" 74 #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
74 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" 75 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
75 #include "third_party/WebKit/public/platform/WebFileInfo.h" 76 #include "third_party/WebKit/public/platform/WebFileInfo.h"
76 #include "third_party/WebKit/public/platform/WebGamepads.h" 77 #include "third_party/WebKit/public/platform/WebGamepads.h"
77 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" 78 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h"
78 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" 79 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 406
406 //------------------------------------------------------------------------------ 407 //------------------------------------------------------------------------------
407 408
408 WebMimeRegistry::SupportsType 409 WebMimeRegistry::SupportsType
409 RendererBlinkPlatformImpl::MimeRegistry::supportsMediaMIMEType( 410 RendererBlinkPlatformImpl::MimeRegistry::supportsMediaMIMEType(
410 const WebString& mime_type, 411 const WebString& mime_type,
411 const WebString& codecs, 412 const WebString& codecs,
412 const WebString& key_system) { 413 const WebString& key_system) {
413 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); 414 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type);
414 // Not supporting the container is a flat-out no. 415 // Not supporting the container is a flat-out no.
415 if (!net::IsSupportedMediaMimeType(mime_type_ascii)) 416 if (!media::IsSupportedMediaMimeType(mime_type_ascii))
416 return IsNotSupported; 417 return IsNotSupported;
417 418
418 if (!key_system.isEmpty()) { 419 if (!key_system.isEmpty()) {
419 // Check whether the key system is supported with the mime_type and codecs. 420 // Check whether the key system is supported with the mime_type and codecs.
420 421
421 // Chromium only supports ASCII parameters. 422 // Chromium only supports ASCII parameters.
422 if (!base::IsStringASCII(key_system)) 423 if (!base::IsStringASCII(key_system))
423 return IsNotSupported; 424 return IsNotSupported;
424 425
425 std::string key_system_ascii = 426 std::string key_system_ascii =
426 media::GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system)); 427 media::GetUnprefixedKeySystemName(base::UTF16ToASCII(key_system));
427 std::vector<std::string> strict_codecs; 428 std::vector<std::string> strict_codecs;
428 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, true); 429 media::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, true);
429 430
430 if (!media::PrefixedIsSupportedKeySystemWithMediaMimeType( 431 if (!media::PrefixedIsSupportedKeySystemWithMediaMimeType(
431 mime_type_ascii, strict_codecs, key_system_ascii)) { 432 mime_type_ascii, strict_codecs, key_system_ascii)) {
432 return IsNotSupported; 433 return IsNotSupported;
433 } 434 }
434 435
435 // Continue processing the mime_type and codecs. 436 // Continue processing the mime_type and codecs.
436 } 437 }
437 438
438 // Check list of strict codecs to see if it is supported. 439 // Check list of strict codecs to see if it is supported.
439 if (net::IsStrictMediaMimeType(mime_type_ascii)) { 440 if (media::IsStrictMediaMimeType(mime_type_ascii)) {
440 // Check if the codecs are a perfect match. 441 // Check if the codecs are a perfect match.
441 std::vector<std::string> strict_codecs; 442 std::vector<std::string> strict_codecs;
442 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); 443 media::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false);
443 return static_cast<WebMimeRegistry::SupportsType> ( 444 return static_cast<WebMimeRegistry::SupportsType> (
444 net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)); 445 media::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs));
445 } 446 }
446 447
447 // If we don't recognize the codec, it's possible we support it. 448 // If we don't recognize the codec, it's possible we support it.
448 std::vector<std::string> parsed_codecs; 449 std::vector<std::string> parsed_codecs;
449 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); 450 media::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true);
450 if (!net::AreSupportedMediaCodecs(parsed_codecs)) 451 if (!media::AreSupportedMediaCodecs(parsed_codecs))
451 return MayBeSupported; 452 return MayBeSupported;
452 453
453 // Otherwise we have a perfect match. 454 // Otherwise we have a perfect match.
454 return IsSupported; 455 return IsSupported;
455 } 456 }
456 457
457 bool RendererBlinkPlatformImpl::MimeRegistry::supportsMediaSourceMIMEType( 458 bool RendererBlinkPlatformImpl::MimeRegistry::supportsMediaSourceMIMEType(
458 const blink::WebString& mime_type, 459 const blink::WebString& mime_type,
459 const WebString& codecs) { 460 const WebString& codecs) {
460 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); 461 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type);
461 std::vector<std::string> parsed_codec_ids; 462 std::vector<std::string> parsed_codec_ids;
462 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false); 463 media::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false);
463 if (mime_type_ascii.empty()) 464 if (mime_type_ascii.empty())
464 return false; 465 return false;
465 return media::StreamParserFactory::IsTypeSupported( 466 return media::StreamParserFactory::IsTypeSupported(
466 mime_type_ascii, parsed_codec_ids); 467 mime_type_ascii, parsed_codec_ids);
467 } 468 }
468 469
469 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( 470 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension(
470 const WebString& file_extension) { 471 const WebString& file_extension) {
471 if (IsPluginProcess()) 472 if (IsPluginProcess())
472 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); 473 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension);
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 //------------------------------------------------------------------------------ 1228 //------------------------------------------------------------------------------
1228 1229
1229 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( 1230 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting(
1230 const blink::WebBatteryStatus& status) { 1231 const blink::WebBatteryStatus& status) {
1231 if (!g_test_battery_status_listener) 1232 if (!g_test_battery_status_listener)
1232 return; 1233 return;
1233 g_test_battery_status_listener->updateBatteryStatus(status); 1234 g_test_battery_status_listener->updateBatteryStatus(status);
1234 } 1235 }
1235 1236
1236 } // namespace content 1237 } // namespace content
OLDNEW
« no previous file with comments | « content/child/assert_matching_enums.cc ('k') | content/shell/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698