| 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" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 70 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
| 71 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 71 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
| 72 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 72 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
| 73 #include "third_party/WebKit/public/platform/WebURL.h" | 73 #include "third_party/WebKit/public/platform/WebURL.h" |
| 74 #include "third_party/WebKit/public/platform/WebVector.h" | 74 #include "third_party/WebKit/public/platform/WebVector.h" |
| 75 #include "ui/gfx/color_profile.h" | 75 #include "ui/gfx/color_profile.h" |
| 76 #include "url/gurl.h" | 76 #include "url/gurl.h" |
| 77 #include "webkit/common/gpu/context_provider_web_context.h" | 77 #include "webkit/common/gpu/context_provider_web_context.h" |
| 78 #include "webkit/common/quota/quota_types.h" | 78 #include "webkit/common/quota/quota_types.h" |
| 79 | 79 |
| 80 #if defined(OS_WIN) | 80 #if defined(OS_ANDROID) |
| 81 #include "content/common/child_process_messages.h" | 81 #include "content/renderer/media/android/audio_decoder_android.h" |
| 82 #include "third_party/WebKit/public/platform/win/WebSandboxSupport.h" | |
| 83 #endif | 82 #endif |
| 84 | 83 |
| 85 #if defined(OS_MACOSX) | 84 #if defined(OS_MACOSX) |
| 86 #include "content/common/mac/font_descriptor.h" | 85 #include "content/common/mac/font_descriptor.h" |
| 87 #include "content/common/mac/font_loader.h" | 86 #include "content/common/mac/font_loader.h" |
| 87 #include "content/renderer/webscrollbarbehavior_impl_mac.h" |
| 88 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" | 88 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" |
| 89 #endif | 89 #endif |
| 90 | 90 |
| 91 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 91 #if defined(OS_POSIX) |
| 92 #include "base/file_descriptor_posix.h" |
| 93 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 92 #include <map> | 94 #include <map> |
| 93 #include <string> | 95 #include <string> |
| 94 | 96 |
| 95 #include "base/synchronization/lock.h" | 97 #include "base/synchronization/lock.h" |
| 96 #include "content/common/child_process_sandbox_support_impl_linux.h" | 98 #include "content/common/child_process_sandbox_support_impl_linux.h" |
| 97 #include "third_party/WebKit/public/platform/linux/WebFontFamily.h" | 99 #include "third_party/WebKit/public/platform/linux/WebFontFamily.h" |
| 98 #include "third_party/WebKit/public/platform/linux/WebSandboxSupport.h" | 100 #include "third_party/WebKit/public/platform/linux/WebSandboxSupport.h" |
| 99 #include "third_party/icu/source/common/unicode/utf16.h" | 101 #include "third_party/icu/source/common/unicode/utf16.h" |
| 100 #endif | 102 #endif |
| 101 | |
| 102 #if defined(OS_POSIX) | |
| 103 #include "base/file_descriptor_posix.h" | |
| 104 #endif | 103 #endif |
| 105 | 104 |
| 106 #if defined(OS_ANDROID) | 105 #if defined(OS_WIN) |
| 107 #include "content/renderer/media/android/audio_decoder_android.h" | 106 #include "content/common/child_process_messages.h" |
| 107 #include "third_party/WebKit/public/platform/win/WebSandboxSupport.h" |
| 108 #endif |
| 109 |
| 110 #if defined(TOOLKIT_GTK) || defined(USE_AURA) |
| 111 #include "content/renderer/webscrollbarbehavior_impl_gtkoraura.h" |
| 112 #elif !defined(OS_MACOSX) |
| 113 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" |
| 114 #define WebScrollbarBehaviorImpl blink::WebScrollbarBehavior |
| 108 #endif | 115 #endif |
| 109 | 116 |
| 110 using blink::Platform; | 117 using blink::Platform; |
| 111 using blink::WebAudioDevice; | 118 using blink::WebAudioDevice; |
| 112 using blink::WebBlobRegistry; | 119 using blink::WebBlobRegistry; |
| 113 using blink::WebDatabaseObserver; | 120 using blink::WebDatabaseObserver; |
| 114 using blink::WebFileInfo; | 121 using blink::WebFileInfo; |
| 115 using blink::WebFileSystem; | 122 using blink::WebFileSystem; |
| 116 using blink::WebGamepads; | 123 using blink::WebGamepads; |
| 117 using blink::WebIDBFactory; | 124 using blink::WebIDBFactory; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 #endif // defined(OS_ANDROID) | 211 #endif // defined(OS_ANDROID) |
| 205 | 212 |
| 206 //------------------------------------------------------------------------------ | 213 //------------------------------------------------------------------------------ |
| 207 | 214 |
| 208 RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl() | 215 RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl() |
| 209 : clipboard_client_(new RendererClipboardClient), | 216 : clipboard_client_(new RendererClipboardClient), |
| 210 clipboard_(new WebClipboardImpl(clipboard_client_.get())), | 217 clipboard_(new WebClipboardImpl(clipboard_client_.get())), |
| 211 mime_registry_(new RendererWebKitPlatformSupportImpl::MimeRegistry), | 218 mime_registry_(new RendererWebKitPlatformSupportImpl::MimeRegistry), |
| 212 sudden_termination_disables_(0), | 219 sudden_termination_disables_(0), |
| 213 plugin_refresh_allowed_(true), | 220 plugin_refresh_allowed_(true), |
| 214 child_thread_loop_(base::MessageLoopProxy::current()) { | 221 child_thread_loop_(base::MessageLoopProxy::current()), |
| 222 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl) { |
| 215 if (g_sandbox_enabled && sandboxEnabled()) { | 223 if (g_sandbox_enabled && sandboxEnabled()) { |
| 216 sandbox_support_.reset( | 224 sandbox_support_.reset( |
| 217 new RendererWebKitPlatformSupportImpl::SandboxSupport); | 225 new RendererWebKitPlatformSupportImpl::SandboxSupport); |
| 218 } else { | 226 } else { |
| 219 DVLOG(1) << "Disabling sandbox support for testing."; | 227 DVLOG(1) << "Disabling sandbox support for testing."; |
| 220 } | 228 } |
| 221 | 229 |
| 222 // ChildThread may not exist in some tests. | 230 // ChildThread may not exist in some tests. |
| 223 if (ChildThread::current()) { | 231 if (ChildThread::current()) { |
| 224 sync_message_filter_ = ChildThread::current()->sync_message_filter(); | 232 sync_message_filter_ = ChildThread::current()->sync_message_filter(); |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 #else | 884 #else |
| 877 // On other platforms, the primary monitor color profile can be read | 885 // On other platforms, the primary monitor color profile can be read |
| 878 // directly. | 886 // directly. |
| 879 gfx::ColorProfile profile; | 887 gfx::ColorProfile profile; |
| 880 *to_profile = profile.profile(); | 888 *to_profile = profile.profile(); |
| 881 #endif | 889 #endif |
| 882 } | 890 } |
| 883 | 891 |
| 884 //------------------------------------------------------------------------------ | 892 //------------------------------------------------------------------------------ |
| 885 | 893 |
| 894 blink::WebScrollbarBehavior* |
| 895 RendererWebKitPlatformSupportImpl::scrollbarBehavior() { |
| 896 return web_scrollbar_behavior_.get(); |
| 897 } |
| 898 |
| 899 //------------------------------------------------------------------------------ |
| 900 |
| 886 WebBlobRegistry* RendererWebKitPlatformSupportImpl::blobRegistry() { | 901 WebBlobRegistry* RendererWebKitPlatformSupportImpl::blobRegistry() { |
| 887 // blob_registry_ can be NULL when running some tests. | 902 // blob_registry_ can be NULL when running some tests. |
| 888 return blob_registry_.get(); | 903 return blob_registry_.get(); |
| 889 } | 904 } |
| 890 | 905 |
| 891 //------------------------------------------------------------------------------ | 906 //------------------------------------------------------------------------------ |
| 892 | 907 |
| 893 void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) { | 908 void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) { |
| 894 if (g_test_gamepads == 0) { | 909 if (g_test_gamepads == 0) { |
| 895 RenderThreadImpl::current()->SampleGamepads(&gamepads); | 910 RenderThreadImpl::current()->SampleGamepads(&gamepads); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 return; | 1155 return; |
| 1141 QuotaDispatcher::ThreadSpecificInstance( | 1156 QuotaDispatcher::ThreadSpecificInstance( |
| 1142 thread_safe_sender_.get(), | 1157 thread_safe_sender_.get(), |
| 1143 quota_message_filter_.get())->QueryStorageUsageAndQuota( | 1158 quota_message_filter_.get())->QueryStorageUsageAndQuota( |
| 1144 storage_partition, | 1159 storage_partition, |
| 1145 static_cast<quota::StorageType>(type), | 1160 static_cast<quota::StorageType>(type), |
| 1146 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 1161 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
| 1147 } | 1162 } |
| 1148 | 1163 |
| 1149 } // namespace content | 1164 } // namespace content |
| OLD | NEW |