| 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/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
| 14 #include "base/platform_file.h" | 14 #include "base/platform_file.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 "content/child/blink_glue.h" |
| 17 #include "content/child/database_util.h" | 18 #include "content/child/database_util.h" |
| 18 #include "content/child/fileapi/webfilesystem_impl.h" | 19 #include "content/child/fileapi/webfilesystem_impl.h" |
| 19 #include "content/child/indexed_db/webidbfactory_impl.h" | 20 #include "content/child/indexed_db/webidbfactory_impl.h" |
| 20 #include "content/child/npapi/npobject_util.h" | 21 #include "content/child/npapi/npobject_util.h" |
| 21 #include "content/child/quota_dispatcher.h" | 22 #include "content/child/quota_dispatcher.h" |
| 22 #include "content/child/quota_message_filter.h" | 23 #include "content/child/quota_message_filter.h" |
| 24 #include "content/child/simple_webmimeregistry_impl.h" |
| 23 #include "content/child/thread_safe_sender.h" | 25 #include "content/child/thread_safe_sender.h" |
| 24 #include "content/child/web_database_observer_impl.h" | 26 #include "content/child/web_database_observer_impl.h" |
| 25 #include "content/child/webblobregistry_impl.h" | 27 #include "content/child/webblobregistry_impl.h" |
| 28 #include "content/child/webfileutilities_impl.h" |
| 26 #include "content/child/webmessageportchannel_impl.h" | 29 #include "content/child/webmessageportchannel_impl.h" |
| 27 #include "content/common/file_utilities_messages.h" | 30 #include "content/common/file_utilities_messages.h" |
| 28 #include "content/common/gpu/client/context_provider_command_buffer.h" | 31 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 29 #include "content/common/gpu/client/gpu_channel_host.h" | 32 #include "content/common/gpu/client/gpu_channel_host.h" |
| 30 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 33 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 31 #include "content/common/gpu/gpu_process_launch_causes.h" | 34 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 32 #include "content/common/mime_registry_messages.h" | 35 #include "content/common/mime_registry_messages.h" |
| 33 #include "content/common/view_messages.h" | 36 #include "content/common/view_messages.h" |
| 34 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
| 35 #include "content/public/common/webplugininfo.h" | 38 #include "content/public/common/webplugininfo.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 66 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 69 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
| 67 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 70 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
| 68 #include "third_party/WebKit/public/platform/WebURL.h" | 71 #include "third_party/WebKit/public/platform/WebURL.h" |
| 69 #include "third_party/WebKit/public/platform/WebVector.h" | 72 #include "third_party/WebKit/public/platform/WebVector.h" |
| 70 #include "third_party/WebKit/public/web/WebFrame.h" | 73 #include "third_party/WebKit/public/web/WebFrame.h" |
| 71 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 74 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 72 #include "ui/gfx/color_profile.h" | 75 #include "ui/gfx/color_profile.h" |
| 73 #include "url/gurl.h" | 76 #include "url/gurl.h" |
| 74 #include "webkit/common/gpu/context_provider_web_context.h" | 77 #include "webkit/common/gpu/context_provider_web_context.h" |
| 75 #include "webkit/common/quota/quota_types.h" | 78 #include "webkit/common/quota/quota_types.h" |
| 76 #include "webkit/glue/simple_webmimeregistry_impl.h" | |
| 77 #include "webkit/glue/webfileutilities_impl.h" | |
| 78 #include "webkit/glue/webkit_glue.h" | |
| 79 | 79 |
| 80 #if defined(OS_WIN) | 80 #if defined(OS_WIN) |
| 81 #include "content/common/child_process_messages.h" | 81 #include "content/common/child_process_messages.h" |
| 82 #include "third_party/WebKit/public/platform/win/WebSandboxSupport.h" | 82 #include "third_party/WebKit/public/platform/win/WebSandboxSupport.h" |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 #if defined(OS_MACOSX) | 85 #if defined(OS_MACOSX) |
| 86 #include "content/common/mac/font_descriptor.h" | 86 #include "content/common/mac/font_descriptor.h" |
| 87 #include "content/common/mac/font_loader.h" | 87 #include "content/common/mac/font_loader.h" |
| 88 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" | 88 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = | 133 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = |
| 134 LAZY_INSTANCE_INITIALIZER; | 134 LAZY_INSTANCE_INITIALIZER; |
| 135 base::LazyInstance<blink::WebDeviceMotionData>::Leaky | 135 base::LazyInstance<blink::WebDeviceMotionData>::Leaky |
| 136 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; | 136 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; |
| 137 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky | 137 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky |
| 138 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; | 138 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; |
| 139 | 139 |
| 140 //------------------------------------------------------------------------------ | 140 //------------------------------------------------------------------------------ |
| 141 | 141 |
| 142 class RendererWebKitPlatformSupportImpl::MimeRegistry | 142 class RendererWebKitPlatformSupportImpl::MimeRegistry |
| 143 : public webkit_glue::SimpleWebMimeRegistryImpl { | 143 : public SimpleWebMimeRegistryImpl { |
| 144 public: | 144 public: |
| 145 virtual blink::WebMimeRegistry::SupportsType supportsMediaMIMEType( | 145 virtual blink::WebMimeRegistry::SupportsType supportsMediaMIMEType( |
| 146 const blink::WebString& mime_type, | 146 const blink::WebString& mime_type, |
| 147 const blink::WebString& codecs, | 147 const blink::WebString& codecs, |
| 148 const blink::WebString& key_system); | 148 const blink::WebString& key_system); |
| 149 virtual bool supportsMediaSourceMIMEType(const blink::WebString& mime_type, | 149 virtual bool supportsMediaSourceMIMEType(const blink::WebString& mime_type, |
| 150 const blink::WebString& codecs); | 150 const blink::WebString& codecs); |
| 151 virtual blink::WebString mimeTypeForExtension( | 151 virtual blink::WebString mimeTypeForExtension( |
| 152 const blink::WebString& file_extension); | 152 const blink::WebString& file_extension); |
| 153 virtual blink::WebString mimeTypeFromFile( | 153 virtual blink::WebString mimeTypeFromFile( |
| 154 const blink::WebString& file_path); | 154 const blink::WebString& file_path); |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 class RendererWebKitPlatformSupportImpl::FileUtilities | 157 class RendererWebKitPlatformSupportImpl::FileUtilities |
| 158 : public webkit_glue::WebFileUtilitiesImpl { | 158 : public WebFileUtilitiesImpl { |
| 159 public: | 159 public: |
| 160 explicit FileUtilities(ThreadSafeSender* sender) | 160 explicit FileUtilities(ThreadSafeSender* sender) |
| 161 : thread_safe_sender_(sender) {} | 161 : thread_safe_sender_(sender) {} |
| 162 virtual bool getFileInfo(const WebString& path, WebFileInfo& result); | 162 virtual bool getFileInfo(const WebString& path, WebFileInfo& result); |
| 163 private: | 163 private: |
| 164 bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) const; | 164 bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) const; |
| 165 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 165 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 #if defined(OS_ANDROID) | 168 #if defined(OS_ANDROID) |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileInfo( | 479 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileInfo( |
| 480 const WebString& path, | 480 const WebString& path, |
| 481 WebFileInfo& web_file_info) { | 481 WebFileInfo& web_file_info) { |
| 482 base::File::Info file_info; | 482 base::File::Info file_info; |
| 483 base::File::Error status; | 483 base::File::Error status; |
| 484 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( | 484 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( |
| 485 base::FilePath::FromUTF16Unsafe(path), &file_info, &status)) || | 485 base::FilePath::FromUTF16Unsafe(path), &file_info, &status)) || |
| 486 status != base::File::FILE_OK) { | 486 status != base::File::FILE_OK) { |
| 487 return false; | 487 return false; |
| 488 } | 488 } |
| 489 webkit_glue::FileInfoToWebFileInfo(file_info, &web_file_info); | 489 FileInfoToWebFileInfo(file_info, &web_file_info); |
| 490 web_file_info.platformPath = path; | 490 web_file_info.platformPath = path; |
| 491 return true; | 491 return true; |
| 492 } | 492 } |
| 493 | 493 |
| 494 bool RendererWebKitPlatformSupportImpl::FileUtilities:: | 494 bool RendererWebKitPlatformSupportImpl::FileUtilities:: |
| 495 SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) const { | 495 SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) const { |
| 496 base::TimeTicks begin = base::TimeTicks::Now(); | 496 base::TimeTicks begin = base::TimeTicks::Now(); |
| 497 const bool success = thread_safe_sender_->Send(msg); | 497 const bool success = thread_safe_sender_->Send(msg); |
| 498 base::TimeDelta delta = base::TimeTicks::Now() - begin; | 498 base::TimeDelta delta = base::TimeTicks::Now() - begin; |
| 499 UMA_HISTOGRAM_TIMES("RendererSyncIPC.ElapsedTime", delta); | 499 UMA_HISTOGRAM_TIMES("RendererSyncIPC.ElapsedTime", delta); |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 return; | 1074 return; |
| 1075 QuotaDispatcher::ThreadSpecificInstance( | 1075 QuotaDispatcher::ThreadSpecificInstance( |
| 1076 thread_safe_sender_.get(), | 1076 thread_safe_sender_.get(), |
| 1077 quota_message_filter_.get())->QueryStorageUsageAndQuota( | 1077 quota_message_filter_.get())->QueryStorageUsageAndQuota( |
| 1078 storage_partition, | 1078 storage_partition, |
| 1079 static_cast<quota::StorageType>(type), | 1079 static_cast<quota::StorageType>(type), |
| 1080 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 1080 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 } // namespace content | 1083 } // namespace content |
| OLD | NEW |