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 21 matching lines...) Expand all Loading... | |
32 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 32 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
33 #include "content/common/gpu/gpu_process_launch_causes.h" | 33 #include "content/common/gpu/gpu_process_launch_causes.h" |
34 #include "content/common/mime_registry_messages.h" | 34 #include "content/common/mime_registry_messages.h" |
35 #include "content/common/screen_orientation_messages.h" | 35 #include "content/common/screen_orientation_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/screen_orientation/screen_orientation_dispatcher.h" | 56 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" |
56 #include "content/renderer/webclipboard_impl.h" | 57 #include "content/renderer/webclipboard_impl.h" |
57 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 58 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
58 #include "content/renderer/webpublicsuffixlist_impl.h" | 59 #include "content/renderer/webpublicsuffixlist_impl.h" |
59 #include "gpu/config/gpu_info.h" | 60 #include "gpu/config/gpu_info.h" |
60 #include "ipc/ipc_sync_message_filter.h" | 61 #include "ipc/ipc_sync_message_filter.h" |
61 #include "media/audio/audio_output_device.h" | 62 #include "media/audio/audio_output_device.h" |
62 #include "media/base/audio_hardware_config.h" | 63 #include "media/base/audio_hardware_config.h" |
63 #include "media/filters/stream_parser_factory.h" | 64 #include "media/filters/stream_parser_factory.h" |
64 #include "net/base/mime_util.h" | 65 #include "net/base/mime_util.h" |
65 #include "net/base/net_util.h" | 66 #include "net/base/net_util.h" |
66 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h" | 67 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h" |
67 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 68 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" |
69 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" | |
68 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h" | 70 #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h" |
69 #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.h" | 71 #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.h" |
70 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 72 #include "third_party/WebKit/public/platform/WebFileInfo.h" |
71 #include "third_party/WebKit/public/platform/WebGamepads.h" | 73 #include "third_party/WebKit/public/platform/WebGamepads.h" |
72 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 74 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
73 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 75 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
74 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 76 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
75 #include "third_party/WebKit/public/platform/WebScreenOrientationListener.h" | 77 #include "third_party/WebKit/public/platform/WebScreenOrientationListener.h" |
76 #include "third_party/WebKit/public/platform/WebURL.h" | 78 #include "third_party/WebKit/public/platform/WebURL.h" |
77 #include "third_party/WebKit/public/platform/WebVector.h" | 79 #include "third_party/WebKit/public/platform/WebVector.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 using blink::WebVector; | 141 using blink::WebVector; |
140 | 142 |
141 namespace content { | 143 namespace content { |
142 | 144 |
143 namespace { | 145 namespace { |
144 | 146 |
145 static bool g_sandbox_enabled = true; | 147 static bool g_sandbox_enabled = true; |
146 static blink::WebGamepadListener* web_gamepad_listener = NULL; | 148 static blink::WebGamepadListener* web_gamepad_listener = NULL; |
147 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = | 149 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads = |
148 LAZY_INSTANCE_INITIALIZER; | 150 LAZY_INSTANCE_INITIALIZER; |
151 double g_test_device_light_data; | |
timvolodine
2014/06/11 15:30:06
does this compile? should it be static? you probab
riju_
2014/06/12 10:34:22
It is inside an anonymous namespace, so why use "s
timvolodine
2014/06/12 15:17:28
looks like there is a difference between compilers
| |
149 base::LazyInstance<blink::WebDeviceMotionData>::Leaky | 152 base::LazyInstance<blink::WebDeviceMotionData>::Leaky |
150 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; | 153 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; |
151 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky | 154 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky |
152 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; | 155 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; |
153 base::LazyInstance<MockScreenOrientationController>::Leaky | 156 base::LazyInstance<MockScreenOrientationController>::Leaky |
154 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER; | 157 g_test_screen_orientation_controller = LAZY_INSTANCE_INITIALIZER; |
155 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky | 158 base::LazyInstance<FakeBatteryStatusDispatcher>::Leaky |
156 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; | 159 g_test_battery_status_dispatcher = LAZY_INSTANCE_INITIALIZER; |
157 | 160 |
158 } // namespace | 161 } // namespace |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1049 //------------------------------------------------------------------------------ | 1052 //------------------------------------------------------------------------------ |
1050 | 1053 |
1051 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( | 1054 blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode( |
1052 const blink::WebString& host, | 1055 const blink::WebString& host, |
1053 const blink::WebString& languages) { | 1056 const blink::WebString& languages) { |
1054 return net::IDNToUnicode(host.utf8(), languages.utf8()); | 1057 return net::IDNToUnicode(host.utf8(), languages.utf8()); |
1055 } | 1058 } |
1056 | 1059 |
1057 //------------------------------------------------------------------------------ | 1060 //------------------------------------------------------------------------------ |
1058 | 1061 |
1062 void RendererWebKitPlatformSupportImpl::setDeviceLightListener( | |
1063 blink::WebDeviceLightListener* listener) { | |
1064 if (g_test_device_light_data == 0) { | |
timvolodine
2014/06/11 15:30:06
so you won't be able to test zero-lux value...
riju_
2014/06/12 10:34:22
Done.
| |
1065 if (!device_light_event_pump_) { | |
1066 device_light_event_pump_.reset(new DeviceLightEventPump); | |
1067 device_light_event_pump_->Attach(RenderThreadImpl::current()); | |
1068 } | |
1069 device_light_event_pump_->SetListener(listener); | |
1070 } else if (listener) { | |
1071 // Testing mode: just echo the test data to the listener. | |
1072 base::MessageLoopProxy::current()->PostTask( | |
1073 FROM_HERE, | |
1074 base::Bind(&blink::WebDeviceLightListener::didChangeDeviceLight, | |
1075 base::Unretained(listener), | |
1076 g_test_device_light_data)); | |
1077 } | |
1078 } | |
1079 | |
1080 // static | |
1081 void RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting( | |
1082 double data) { | |
1083 g_test_device_light_data = data; | |
1084 } | |
1085 | |
1086 | |
1087 //------------------------------------------------------------------------------ | |
1088 | |
1059 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( | 1089 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener( |
1060 blink::WebDeviceMotionListener* listener) { | 1090 blink::WebDeviceMotionListener* listener) { |
1061 if (g_test_device_motion_data == 0) { | 1091 if (g_test_device_motion_data == 0) { |
1062 if (!device_motion_event_pump_) { | 1092 if (!device_motion_event_pump_) { |
1063 device_motion_event_pump_.reset(new DeviceMotionEventPump); | 1093 device_motion_event_pump_.reset(new DeviceMotionEventPump); |
1064 device_motion_event_pump_->Attach(RenderThreadImpl::current()); | 1094 device_motion_event_pump_->Attach(RenderThreadImpl::current()); |
1065 } | 1095 } |
1066 device_motion_event_pump_->SetListener(listener); | 1096 device_motion_event_pump_->SetListener(listener); |
1067 } else if (listener) { | 1097 } else if (listener) { |
1068 // Testing mode: just echo the test data to the listener. | 1098 // Testing mode: just echo the test data to the listener. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1208 battery_status_dispatcher_->SetListener(listener); | 1238 battery_status_dispatcher_->SetListener(listener); |
1209 } | 1239 } |
1210 | 1240 |
1211 // static | 1241 // static |
1212 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1242 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
1213 const blink::WebBatteryStatus& status) { | 1243 const blink::WebBatteryStatus& status) { |
1214 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1244 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
1215 } | 1245 } |
1216 | 1246 |
1217 } // namespace content | 1247 } // namespace content |
OLD | NEW |