| 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 20 matching lines...) Expand all Loading... |
| 31 #include "content/common/gpu/client/context_provider_command_buffer.h" | 31 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 32 #include "content/common/gpu/client/gpu_channel_host.h" | 32 #include "content/common/gpu/client/gpu_channel_host.h" |
| 33 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 33 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 34 #include "content/common/gpu/gpu_process_launch_causes.h" | 34 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 35 #include "content/common/mime_registry_messages.h" | 35 #include "content/common/mime_registry_messages.h" |
| 36 #include "content/common/screen_orientation_messages.h" | 36 #include "content/common/screen_orientation_messages.h" |
| 37 #include "content/common/view_messages.h" | 37 #include "content/common/view_messages.h" |
| 38 #include "content/public/common/content_switches.h" | 38 #include "content/public/common/content_switches.h" |
| 39 #include "content/public/common/webplugininfo.h" | 39 #include "content/public/common/webplugininfo.h" |
| 40 #include "content/public/renderer/content_renderer_client.h" | 40 #include "content/public/renderer/content_renderer_client.h" |
| 41 #include "content/renderer/device_light/device_light_event_pump.h" |
| 41 #include "content/renderer/device_orientation/device_motion_event_pump.h" | 42 #include "content/renderer/device_orientation/device_motion_event_pump.h" |
| 42 #include "content/renderer/device_orientation/device_orientation_event_pump.h" | 43 #include "content/renderer/device_orientation/device_orientation_event_pump.h" |
| 43 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 44 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 44 #include "content/renderer/gamepad_shared_memory_reader.h" | 45 #include "content/renderer/gamepad_shared_memory_reader.h" |
| 45 #include "content/renderer/media/audio_decoder.h" | 46 #include "content/renderer/media/audio_decoder.h" |
| 46 #include "content/renderer/media/crypto/key_systems.h" | 47 #include "content/renderer/media/crypto/key_systems.h" |
| 47 #include "content/renderer/media/media_stream_dependency_factory.h" | 48 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 48 #include "content/renderer/media/renderer_webaudiodevice_impl.h" | 49 #include "content/renderer/media/renderer_webaudiodevice_impl.h" |
| 49 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" | 50 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" |
| 50 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" | 51 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" |
| 51 #include "content/renderer/render_thread_impl.h" | 52 #include "content/renderer/render_thread_impl.h" |
| 52 #include "content/renderer/renderer_clipboard_client.h" | 53 #include "content/renderer/renderer_clipboard_client.h" |
| 53 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" | 54 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" |
| 54 #include "content/renderer/webclipboard_impl.h" | 55 #include "content/renderer/webclipboard_impl.h" |
| 55 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 56 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
| 56 #include "content/renderer/webpublicsuffixlist_impl.h" | 57 #include "content/renderer/webpublicsuffixlist_impl.h" |
| 57 #include "gpu/config/gpu_info.h" | 58 #include "gpu/config/gpu_info.h" |
| 58 #include "ipc/ipc_sync_message_filter.h" | 59 #include "ipc/ipc_sync_message_filter.h" |
| 59 #include "media/audio/audio_output_device.h" | 60 #include "media/audio/audio_output_device.h" |
| 60 #include "media/base/audio_hardware_config.h" | 61 #include "media/base/audio_hardware_config.h" |
| 61 #include "media/filters/stream_parser_factory.h" | 62 #include "media/filters/stream_parser_factory.h" |
| 62 #include "net/base/mime_util.h" | 63 #include "net/base/mime_util.h" |
| 63 #include "net/base/net_util.h" | 64 #include "net/base/net_util.h" |
| 64 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 65 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" |
| 66 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" |
| 65 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h" | 67 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h" |
| 66 #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.h" | 68 #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.h" |
| 67 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 69 #include "third_party/WebKit/public/platform/WebFileInfo.h" |
| 68 #include "third_party/WebKit/public/platform/WebGamepads.h" | 70 #include "third_party/WebKit/public/platform/WebGamepads.h" |
| 69 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 71 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
| 70 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 72 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
| 71 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 73 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
| 72 #include "third_party/WebKit/public/platform/WebScreenOrientationListener.h" | 74 #include "third_party/WebKit/public/platform/WebScreenOrientationListener.h" |
| 73 #include "third_party/WebKit/public/platform/WebURL.h" | 75 #include "third_party/WebKit/public/platform/WebURL.h" |
| 74 #include "third_party/WebKit/public/platform/WebVector.h" | 76 #include "third_party/WebKit/public/platform/WebVector.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 using blink::WebString; | 135 using blink::WebString; |
| 134 using blink::WebURL; | 136 using blink::WebURL; |
| 135 using blink::WebVector; | 137 using blink::WebVector; |
| 136 | 138 |
| 137 namespace content { | 139 namespace content { |
| 138 | 140 |
| 139 static bool g_sandbox_enabled = true; | 141 static bool g_sandbox_enabled = true; |
| 140 static blink::WebGamepadListener* web_gamepad_listener = NULL; | 142 static blink::WebGamepadListener* web_gamepad_listener = NULL; |
| 141 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = | 143 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = |
| 142 LAZY_INSTANCE_INITIALIZER; | 144 LAZY_INSTANCE_INITIALIZER; |
| 145 base::LazyInstance<double>::Leaky |
| 146 g_test_device_light_data = LAZY_INSTANCE_INITIALIZER; |
| 143 base::LazyInstance<blink::WebDeviceMotionData>::Leaky | 147 base::LazyInstance<blink::WebDeviceMotionData>::Leaky |
| 144 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; | 148 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; |
| 145 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky | 149 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky |
| 146 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; | 150 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; |
| 147 base::LazyInstance<blink::WebScreenOrientation>::Leaky | 151 base::LazyInstance<blink::WebScreenOrientation>::Leaky |
| 148 g_test_screen_orientation_value = LAZY_INSTANCE_INITIALIZER; | 152 g_test_screen_orientation_value = LAZY_INSTANCE_INITIALIZER; |
| 149 | 153 |
| 150 //------------------------------------------------------------------------------ | 154 //------------------------------------------------------------------------------ |
| 151 | 155 |
| 152 class RendererWebKitPlatformSupportImpl::MimeRegistry | 156 class RendererWebKitPlatformSupportImpl::MimeRegistry |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 //------------------------------------------------------------------------------ | 1040 //------------------------------------------------------------------------------ |
| 1037 | 1041 |
| 1038 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( | 1042 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( |
| 1039 const blink::WebString& host, | 1043 const blink::WebString& host, |
| 1040 const blink::WebString& languages) { | 1044 const blink::WebString& languages) { |
| 1041 return net::IDNToUnicode(host.utf8(), languages.utf8()); | 1045 return net::IDNToUnicode(host.utf8(), languages.utf8()); |
| 1042 } | 1046 } |
| 1043 | 1047 |
| 1044 //------------------------------------------------------------------------------ | 1048 //------------------------------------------------------------------------------ |
| 1045 | 1049 |
| 1050 void RendererWebKitPlatformSupportImpl::setDeviceLightListener( |
| 1051 blink::WebDeviceLightListener* listener) { |
| 1052 if (g_test_device_light_data == 0) { |
| 1053 if (!device_light_event_pump_) { |
| 1054 device_light_event_pump_.reset(new DeviceLightEventPump); |
| 1055 device_light_event_pump_->Attach(RenderThreadImpl::current()); |
| 1056 } |
| 1057 device_light_event_pump_->SetListener(listener); |
| 1058 } else if (listener) { |
| 1059 // Testing mode: just echo the test data to the listener. |
| 1060 base::MessageLoopProxy::current()->PostTask( |
| 1061 FROM_HERE, |
| 1062 base::Bind(&blink::WebDeviceLightListener::didChangeDeviceLight, |
| 1063 base::Unretained(listener), |
| 1064 g_test_device_light_data.Get())); |
| 1065 } |
| 1066 } |
| 1067 |
| 1068 // static |
| 1069 void RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting( |
| 1070 const double& data) { |
| 1071 g_test_device_light_data.Get() = data; |
| 1072 } |
| 1073 |
| 1074 //------------------------------------------------------------------------------ |
| 1075 |
| 1046 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( | 1076 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( |
| 1047 blink::WebDeviceMotionListener* listener) { | 1077 blink::WebDeviceMotionListener* listener) { |
| 1048 if (g_test_device_motion_data == 0) { | 1078 if (g_test_device_motion_data == 0) { |
| 1049 if (!device_motion_event_pump_) { | 1079 if (!device_motion_event_pump_) { |
| 1050 device_motion_event_pump_.reset(new DeviceMotionEventPump); | 1080 device_motion_event_pump_.reset(new DeviceMotionEventPump); |
| 1051 device_motion_event_pump_->Attach(RenderThreadImpl::current()); | 1081 device_motion_event_pump_->Attach(RenderThreadImpl::current()); |
| 1052 } | 1082 } |
| 1053 device_motion_event_pump_->SetListener(listener); | 1083 device_motion_event_pump_->SetListener(listener); |
| 1054 } else if (listener) { | 1084 } else if (listener) { |
| 1055 // Testing mode: just echo the test data to the listener. | 1085 // Testing mode: just echo the test data to the listener. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 return; | 1193 return; |
| 1164 QuotaDispatcher::ThreadSpecificInstance( | 1194 QuotaDispatcher::ThreadSpecificInstance( |
| 1165 thread_safe_sender_.get(), | 1195 thread_safe_sender_.get(), |
| 1166 quota_message_filter_.get())->QueryStorageUsageAndQuota( | 1196 quota_message_filter_.get())->QueryStorageUsageAndQuota( |
| 1167 storage_partition, | 1197 storage_partition, |
| 1168 static_cast<quota::StorageType>(type), | 1198 static_cast<quota::StorageType>(type), |
| 1169 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 1199 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
| 1170 } | 1200 } |
| 1171 | 1201 |
| 1172 } // namespace content | 1202 } // namespace content |
| OLD | NEW |