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 15 matching lines...) Expand all Loading... |
26 #include "content/child/web_database_observer_impl.h" | 26 #include "content/child/web_database_observer_impl.h" |
27 #include "content/child/webblobregistry_impl.h" | 27 #include "content/child/webblobregistry_impl.h" |
28 #include "content/child/webfileutilities_impl.h" | 28 #include "content/child/webfileutilities_impl.h" |
29 #include "content/child/webmessageportchannel_impl.h" | 29 #include "content/child/webmessageportchannel_impl.h" |
30 #include "content/common/file_utilities_messages.h" | 30 #include "content/common/file_utilities_messages.h" |
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/view_messages.h" | 37 #include "content/common/view_messages.h" |
37 #include "content/public/common/content_switches.h" | 38 #include "content/public/common/content_switches.h" |
38 #include "content/public/common/webplugininfo.h" | 39 #include "content/public/common/webplugininfo.h" |
39 #include "content/public/renderer/content_renderer_client.h" | 40 #include "content/public/renderer/content_renderer_client.h" |
40 #include "content/renderer/battery_status/battery_status_dispatcher.h" | 41 #include "content/renderer/battery_status/battery_status_dispatcher.h" |
41 #include "content/renderer/battery_status/fake_battery_status_dispatcher.h" | 42 #include "content/renderer/battery_status/fake_battery_status_dispatcher.h" |
42 #include "content/renderer/device_sensors/device_light_event_pump.h" | 43 #include "content/renderer/device_sensors/device_light_event_pump.h" |
43 #include "content/renderer/device_sensors/device_motion_event_pump.h" | 44 #include "content/renderer/device_sensors/device_motion_event_pump.h" |
44 #include "content/renderer/device_sensors/device_orientation_event_pump.h" | 45 #include "content/renderer/device_sensors/device_orientation_event_pump.h" |
45 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 46 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 static_cast<blink::WebDeviceLightListener*>(listener)); | 1068 static_cast<blink::WebDeviceLightListener*>(listener)); |
1068 break; | 1069 break; |
1069 case blink::WebPlatformEventBattery: | 1070 case blink::WebPlatformEventBattery: |
1070 SetBatteryStatusListener( | 1071 SetBatteryStatusListener( |
1071 static_cast<blink::WebBatteryStatusListener*>(listener)); | 1072 static_cast<blink::WebBatteryStatusListener*>(listener)); |
1072 break; | 1073 break; |
1073 case blink::WebPlatformEventGamepad: | 1074 case blink::WebPlatformEventGamepad: |
1074 SetGamepadListener( | 1075 SetGamepadListener( |
1075 static_cast<blink::WebGamepadListener*>(listener)); | 1076 static_cast<blink::WebGamepadListener*>(listener)); |
1076 break; | 1077 break; |
| 1078 case blink::WebPlatformEventScreenOrientation: |
| 1079 RenderThread::Get()->Send(new ScreenOrientationHostMsg_StartListening()); |
| 1080 break; |
1077 default: | 1081 default: |
1078 // A default statement is required to prevent compilation errors when Blink | 1082 // A default statement is required to prevent compilation errors when Blink |
1079 // adds a new type. | 1083 // adds a new type. |
1080 VLOG(1) << "RendererWebKitPlatformSupportImpl::startListening() with " | 1084 VLOG(1) << "RendererWebKitPlatformSupportImpl::startListening() with " |
1081 "unknown type."; | 1085 "unknown type."; |
1082 } | 1086 } |
1083 } | 1087 } |
1084 | 1088 |
1085 void RendererWebKitPlatformSupportImpl::stopListening( | 1089 void RendererWebKitPlatformSupportImpl::stopListening( |
1086 blink::WebPlatformEventType type) { | 1090 blink::WebPlatformEventType type) { |
1087 switch (type) { | 1091 switch (type) { |
1088 case blink::WebPlatformEventDeviceMotion: | 1092 case blink::WebPlatformEventDeviceMotion: |
1089 SetDeviceMotionListener(0); | 1093 SetDeviceMotionListener(0); |
1090 break; | 1094 break; |
1091 case blink::WebPlatformEventDeviceOrientation: | 1095 case blink::WebPlatformEventDeviceOrientation: |
1092 SetDeviceOrientationListener(0); | 1096 SetDeviceOrientationListener(0); |
1093 break; | 1097 break; |
1094 case blink::WebPlatformEventDeviceLight: | 1098 case blink::WebPlatformEventDeviceLight: |
1095 SetDeviceLightListener(0); | 1099 SetDeviceLightListener(0); |
1096 break; | 1100 break; |
1097 case blink::WebPlatformEventBattery: | 1101 case blink::WebPlatformEventBattery: |
1098 SetBatteryStatusListener(0); | 1102 SetBatteryStatusListener(0); |
1099 break; | 1103 break; |
1100 case blink::WebPlatformEventGamepad: | 1104 case blink::WebPlatformEventGamepad: |
1101 SetGamepadListener(0); | 1105 SetGamepadListener(0); |
1102 break; | 1106 break; |
| 1107 case blink::WebPlatformEventScreenOrientation: |
| 1108 RenderThread::Get()->Send(new ScreenOrientationHostMsg_StopListening()); |
| 1109 break; |
1103 default: | 1110 default: |
1104 // A default statement is required to prevent compilation errors when Blink | 1111 // A default statement is required to prevent compilation errors when Blink |
1105 // adds a new type. | 1112 // adds a new type. |
1106 VLOG(1) << "RendererWebKitPlatformSupportImpl::stopListening() with " | 1113 VLOG(1) << "RendererWebKitPlatformSupportImpl::stopListening() with " |
1107 "unknown type."; | 1114 "unknown type."; |
1108 } | 1115 } |
1109 } | 1116 } |
1110 | 1117 |
1111 void RendererWebKitPlatformSupportImpl::SetDeviceMotionListener( | 1118 void RendererWebKitPlatformSupportImpl::SetDeviceMotionListener( |
1112 blink::WebDeviceMotionListener* listener) { | 1119 blink::WebDeviceMotionListener* listener) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 | 1212 |
1206 //------------------------------------------------------------------------------ | 1213 //------------------------------------------------------------------------------ |
1207 | 1214 |
1208 // static | 1215 // static |
1209 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1216 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
1210 const blink::WebBatteryStatus& status) { | 1217 const blink::WebBatteryStatus& status) { |
1211 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1218 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
1212 } | 1219 } |
1213 | 1220 |
1214 } // namespace content | 1221 } // namespace content |
OLD | NEW |