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; |
144 static blink::WebGamepadListener* web_gamepad_listener = NULL; | 146 blink::WebGamepadListener* web_gamepad_listener = NULL; |
145 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = | 147 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = |
146 LAZY_INSTANCE_INITIALIZER; | 148 LAZY_INSTANCE_INITIALIZER; |
| 149 double g_test_device_light_data = -1; |
147 base::LazyInstance<blink::WebDeviceMotionData>::Leaky | 150 base::LazyInstance<blink::WebDeviceMotionData>::Leaky |
148 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; | 151 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; |
149 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky | 152 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky |
150 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; | 153 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; |
151 base::LazyInstance<MockScreenOrientationController>::Leaky | 154 base::LazyInstance<MockScreenOrientationController>::Leaky |
152 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER; | 155 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER; |
153 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky | 156 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky |
154 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; | 157 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; |
155 | 158 |
156 } // namespace | 159 } // namespace |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 //------------------------------------------------------------------------------ | 1075 //------------------------------------------------------------------------------ |
1073 | 1076 |
1074 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( | 1077 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( |
1075 const blink::WebString& host, | 1078 const blink::WebString& host, |
1076 const blink::WebString& languages) { | 1079 const blink::WebString& languages) { |
1077 return net::IDNToUnicode(host.utf8(), languages.utf8()); | 1080 return net::IDNToUnicode(host.utf8(), languages.utf8()); |
1078 } | 1081 } |
1079 | 1082 |
1080 //------------------------------------------------------------------------------ | 1083 //------------------------------------------------------------------------------ |
1081 | 1084 |
| 1085 void RendererWebKitPlatformSupportImpl::setDeviceLightListener( |
| 1086 blink::WebDeviceLightListener* listener) { |
| 1087 if (g_test_device_light_data < 0) { |
| 1088 if (!device_light_event_pump_) { |
| 1089 device_light_event_pump_.reset(new DeviceLightEventPump); |
| 1090 device_light_event_pump_->Attach(RenderThreadImpl::current()); |
| 1091 } |
| 1092 device_light_event_pump_->SetListener(listener); |
| 1093 } else if (listener) { |
| 1094 // Testing mode: just echo the test data to the listener. |
| 1095 base::MessageLoopProxy::current()->PostTask( |
| 1096 FROM_HERE, |
| 1097 base::Bind(&blink::WebDeviceLightListener::didChangeDeviceLight, |
| 1098 base::Unretained(listener), |
| 1099 g_test_device_light_data)); |
| 1100 } |
| 1101 } |
| 1102 |
| 1103 // static |
| 1104 void RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting( |
| 1105 double data) { |
| 1106 g_test_device_light_data = data; |
| 1107 } |
| 1108 |
| 1109 //------------------------------------------------------------------------------ |
| 1110 |
1082 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( | 1111 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( |
1083 blink::WebDeviceMotionListener* listener) { | 1112 blink::WebDeviceMotionListener* listener) { |
1084 if (g_test_device_motion_data == 0) { | 1113 if (g_test_device_motion_data == 0) { |
1085 if (!device_motion_event_pump_) { | 1114 if (!device_motion_event_pump_) { |
1086 device_motion_event_pump_.reset(new DeviceMotionEventPump); | 1115 device_motion_event_pump_.reset(new DeviceMotionEventPump); |
1087 device_motion_event_pump_->Attach(RenderThreadImpl::current()); | 1116 device_motion_event_pump_->Attach(RenderThreadImpl::current()); |
1088 } | 1117 } |
1089 device_motion_event_pump_->SetListener(listener); | 1118 device_motion_event_pump_->SetListener(listener); |
1090 } else if (listener) { | 1119 } else if (listener) { |
1091 // Testing mode: just echo the test data to the listener. | 1120 // Testing mode: just echo the test data to the listener. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 battery_status_dispatcher_->SetListener(listener); | 1223 battery_status_dispatcher_->SetListener(listener); |
1195 } | 1224 } |
1196 | 1225 |
1197 // static | 1226 // static |
1198 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1227 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
1199 const blink::WebBatteryStatus& status) { | 1228 const blink::WebBatteryStatus& status) { |
1200 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1229 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
1201 } | 1230 } |
1202 | 1231 |
1203 } // namespace content | 1232 } // namespace content |
OLD | NEW |