| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 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/view_messages.h" | 36 #include "content/common/view_messages.h" |
| 37 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
| 38 #include "content/public/common/webplugininfo.h" | 38 #include "content/public/common/webplugininfo.h" |
| 39 #include "content/public/renderer/content_renderer_client.h" | 39 #include "content/public/renderer/content_renderer_client.h" |
| 40 #include "content/renderer/battery_status/battery_status_dispatcher.h" | 40 #include "content/renderer/battery_status/battery_status_dispatcher.h" |
| 41 #include "content/renderer/battery_status/fake_battery_status_dispatcher.h" | 41 #include "content/renderer/battery_status/fake_battery_status_dispatcher.h" |
| 42 #include "content/renderer/device_sensors/device_light_event_pump.h" |
| 42 #include "content/renderer/device_sensors/device_motion_event_pump.h" | 43 #include "content/renderer/device_sensors/device_motion_event_pump.h" |
| 43 #include "content/renderer/device_sensors/device_orientation_event_pump.h" | 44 #include "content/renderer/device_sensors/device_orientation_event_pump.h" |
| 44 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 45 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 45 #include "content/renderer/gamepad_shared_memory_reader.h" | 46 #include "content/renderer/gamepad_shared_memory_reader.h" |
| 46 #include "content/renderer/media/audio_decoder.h" | 47 #include "content/renderer/media/audio_decoder.h" |
| 47 #include "content/renderer/media/crypto/key_systems.h" | 48 #include "content/renderer/media/crypto/key_systems.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/media/webrtc/peer_connection_dependency_factory.h" | 52 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" |
| 52 #include "content/renderer/render_thread_impl.h" | 53 #include "content/renderer/render_thread_impl.h" |
| 53 #include "content/renderer/renderer_clipboard_client.h" | 54 #include "content/renderer/renderer_clipboard_client.h" |
| 54 #include "content/renderer/screen_orientation/mock_screen_orientation_controller
.h" | 55 #include "content/renderer/screen_orientation/mock_screen_orientation_controller
.h" |
| 55 #include "content/renderer/webclipboard_impl.h" | 56 #include "content/renderer/webclipboard_impl.h" |
| 56 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 57 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
| 57 #include "content/renderer/webpublicsuffixlist_impl.h" | 58 #include "content/renderer/webpublicsuffixlist_impl.h" |
| 58 #include "gpu/config/gpu_info.h" | 59 #include "gpu/config/gpu_info.h" |
| 59 #include "ipc/ipc_sync_message_filter.h" | 60 #include "ipc/ipc_sync_message_filter.h" |
| 60 #include "media/audio/audio_output_device.h" | 61 #include "media/audio/audio_output_device.h" |
| 61 #include "media/base/audio_hardware_config.h" | 62 #include "media/base/audio_hardware_config.h" |
| 62 #include "media/filters/stream_parser_factory.h" | 63 #include "media/filters/stream_parser_factory.h" |
| 63 #include "net/base/mime_util.h" | 64 #include "net/base/mime_util.h" |
| 64 #include "net/base/net_util.h" | 65 #include "net/base/net_util.h" |
| 65 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h" | 66 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h" |
| 66 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 67 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" |
| 68 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" |
| 67 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h" | 69 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h" |
| 68 #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.h" | 70 #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.h" |
| 69 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 71 #include "third_party/WebKit/public/platform/WebFileInfo.h" |
| 70 #include "third_party/WebKit/public/platform/WebGamepads.h" | 72 #include "third_party/WebKit/public/platform/WebGamepads.h" |
| 71 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 73 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
| 72 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 74 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
| 73 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 75 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
| 74 #include "third_party/WebKit/public/platform/WebURL.h" | 76 #include "third_party/WebKit/public/platform/WebURL.h" |
| 75 #include "third_party/WebKit/public/platform/WebVector.h" | 77 #include "third_party/WebKit/public/platform/WebVector.h" |
| 76 #include "ui/gfx/color_profile.h" | 78 #include "ui/gfx/color_profile.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 using blink::WebRTCPeerConnectionHandlerClient; | 135 using blink::WebRTCPeerConnectionHandlerClient; |
| 134 using blink::WebStorageNamespace; | 136 using blink::WebStorageNamespace; |
| 135 using blink::WebString; | 137 using blink::WebString; |
| 136 using blink::WebURL; | 138 using blink::WebURL; |
| 137 using blink::WebVector; | 139 using blink::WebVector; |
| 138 | 140 |
| 139 namespace content { | 141 namespace content { |
| 140 | 142 |
| 141 namespace { | 143 namespace { |
| 142 | 144 |
| 143 static bool g_sandbox_enabled = true; | 145 bool g_sandbox_enabled = true; |
| 146 double g_test_device_light_data = -1; |
| 144 base::LazyInstance<blink::WebDeviceMotionData>::Leaky | 147 base::LazyInstance<blink::WebDeviceMotionData>::Leaky |
| 145 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; | 148 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; |
| 146 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky | 149 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky |
| 147 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; | 150 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; |
| 148 base::LazyInstance<MockScreenOrientationController>::Leaky | 151 base::LazyInstance<MockScreenOrientationController>::Leaky |
| 149 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER; | 152 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER; |
| 150 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky | 153 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky |
| 151 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; | 154 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; |
| 152 | 155 |
| 153 } // namespace | 156 } // namespace |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 //------------------------------------------------------------------------------ | 1017 //------------------------------------------------------------------------------ |
| 1015 | 1018 |
| 1016 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( | 1019 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( |
| 1017 const blink::WebString& host, | 1020 const blink::WebString& host, |
| 1018 const blink::WebString& languages) { | 1021 const blink::WebString& languages) { |
| 1019 return net::IDNToUnicode(host.utf8(), languages.utf8()); | 1022 return net::IDNToUnicode(host.utf8(), languages.utf8()); |
| 1020 } | 1023 } |
| 1021 | 1024 |
| 1022 //------------------------------------------------------------------------------ | 1025 //------------------------------------------------------------------------------ |
| 1023 | 1026 |
| 1027 void RendererWebKitPlatformSupportImpl::setDeviceLightListener( |
| 1028 blink::WebDeviceLightListener* listener) { |
| 1029 if (g_test_device_light_data < 0) { |
| 1030 if (!device_light_event_pump_) { |
| 1031 device_light_event_pump_.reset(new DeviceLightEventPump); |
| 1032 device_light_event_pump_->Attach(RenderThreadImpl::current()); |
| 1033 } |
| 1034 device_light_event_pump_->SetListener(listener); |
| 1035 } else if (listener) { |
| 1036 // Testing mode: just echo the test data to the listener. |
| 1037 base::MessageLoopProxy::current()->PostTask( |
| 1038 FROM_HERE, |
| 1039 base::Bind(&blink::WebDeviceLightListener::didChangeDeviceLight, |
| 1040 base::Unretained(listener), |
| 1041 g_test_device_light_data)); |
| 1042 } |
| 1043 } |
| 1044 |
| 1045 // static |
| 1046 void RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting( |
| 1047 double data) { |
| 1048 g_test_device_light_data = data; |
| 1049 } |
| 1050 |
| 1051 //------------------------------------------------------------------------------ |
| 1052 |
| 1024 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( | 1053 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( |
| 1025 blink::WebDeviceMotionListener* listener) { | 1054 blink::WebDeviceMotionListener* listener) { |
| 1026 if (g_test_device_motion_data == 0) { | 1055 if (g_test_device_motion_data == 0) { |
| 1027 if (!device_motion_event_pump_) { | 1056 if (!device_motion_event_pump_) { |
| 1028 device_motion_event_pump_.reset(new DeviceMotionEventPump); | 1057 device_motion_event_pump_.reset(new DeviceMotionEventPump); |
| 1029 device_motion_event_pump_->Attach(RenderThreadImpl::current()); | 1058 device_motion_event_pump_->Attach(RenderThreadImpl::current()); |
| 1030 } | 1059 } |
| 1031 device_motion_event_pump_->SetListener(listener); | 1060 device_motion_event_pump_->SetListener(listener); |
| 1032 } else if (listener) { | 1061 } else if (listener) { |
| 1033 // Testing mode: just echo the test data to the listener. | 1062 // Testing mode: just echo the test data to the listener. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 battery_status_dispatcher_->SetListener(listener); | 1165 battery_status_dispatcher_->SetListener(listener); |
| 1137 } | 1166 } |
| 1138 | 1167 |
| 1139 // static | 1168 // static |
| 1140 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1169 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
| 1141 const blink::WebBatteryStatus& status) { | 1170 const blink::WebBatteryStatus& status) { |
| 1142 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1171 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
| 1143 } | 1172 } |
| 1144 | 1173 |
| 1145 } // namespace content | 1174 } // namespace content |
| OLD | NEW |