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" | |
11 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
13 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
14 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
15 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
17 #include "content/child/blink_glue.h" | 16 #include "content/child/blink_glue.h" |
18 #include "content/child/database_util.h" | 17 #include "content/child/database_util.h" |
19 #include "content/child/fileapi/webfilesystem_impl.h" | 18 #include "content/child/fileapi/webfilesystem_impl.h" |
20 #include "content/child/indexed_db/webidbfactory_impl.h" | 19 #include "content/child/indexed_db/webidbfactory_impl.h" |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 | 1073 |
1075 // static | 1074 // static |
1076 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting( | 1075 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting( |
1077 const blink::WebDeviceMotionData& data) { | 1076 const blink::WebDeviceMotionData& data) { |
1078 g_test_device_motion_data.Get() = data; | 1077 g_test_device_motion_data.Get() = data; |
1079 } | 1078 } |
1080 | 1079 |
1081 // static | 1080 // static |
1082 void RendererWebKitPlatformSupportImpl::ResetMockScreenOrientationForTesting() | 1081 void RendererWebKitPlatformSupportImpl::ResetMockScreenOrientationForTesting() |
1083 { | 1082 { |
1084 DCHECK(!(g_test_screen_orientation_controller == 0)); | |
1085 g_test_screen_orientation_controller.Get().ResetData(); | 1083 g_test_screen_orientation_controller.Get().ResetData(); |
1086 } | 1084 } |
1087 | 1085 |
1088 //------------------------------------------------------------------------------ | 1086 //------------------------------------------------------------------------------ |
1089 | 1087 |
1090 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener( | 1088 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener( |
1091 blink::WebDeviceOrientationListener* listener) { | 1089 blink::WebDeviceOrientationListener* listener) { |
1092 if (g_test_device_orientation_data == 0) { | 1090 if (g_test_device_orientation_data == 0) { |
1093 if (!device_orientation_event_pump_) { | 1091 if (!device_orientation_event_pump_) { |
1094 device_orientation_event_pump_.reset(new DeviceOrientationEventPump); | 1092 device_orientation_event_pump_.reset(new DeviceOrientationEventPump); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 if (RenderThreadImpl::current() && | 1157 if (RenderThreadImpl::current() && |
1160 RenderThreadImpl::current()->layout_test_mode()) { | 1158 RenderThreadImpl::current()->layout_test_mode()) { |
1161 g_test_screen_orientation_controller.Get().ResetLock(); | 1159 g_test_screen_orientation_controller.Get().ResetLock(); |
1162 return; | 1160 return; |
1163 } | 1161 } |
1164 RenderThread::Get()->Send(new ScreenOrientationHostMsg_Unlock); | 1162 RenderThread::Get()->Send(new ScreenOrientationHostMsg_Unlock); |
1165 } | 1163 } |
1166 | 1164 |
1167 // static | 1165 // static |
1168 void RendererWebKitPlatformSupportImpl::SetMockScreenOrientationForTesting( | 1166 void RendererWebKitPlatformSupportImpl::SetMockScreenOrientationForTesting( |
1169 RenderView* render_view, | |
1170 blink::WebScreenOrientationType orientation) { | 1167 blink::WebScreenOrientationType orientation) { |
1171 g_test_screen_orientation_controller.Get() | 1168 g_test_screen_orientation_controller.Get() |
1172 .UpdateDeviceOrientation(render_view, orientation); | 1169 .UpdateDeviceOrientation(orientation); |
1173 } | 1170 } |
1174 | 1171 |
1175 //------------------------------------------------------------------------------ | 1172 //------------------------------------------------------------------------------ |
1176 | 1173 |
1177 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( | 1174 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( |
1178 const blink::WebURL& storage_partition, | 1175 const blink::WebURL& storage_partition, |
1179 blink::WebStorageQuotaType type, | 1176 blink::WebStorageQuotaType type, |
1180 blink::WebStorageQuotaCallbacks callbacks) { | 1177 blink::WebStorageQuotaCallbacks callbacks) { |
1181 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) | 1178 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) |
1182 return; | 1179 return; |
(...skipping 10 matching lines...) Expand all Loading... |
1193 void RendererWebKitPlatformSupportImpl::setBatteryStatusListener( | 1190 void RendererWebKitPlatformSupportImpl::setBatteryStatusListener( |
1194 blink::WebBatteryStatusListener* listener) { | 1191 blink::WebBatteryStatusListener* listener) { |
1195 if (!battery_status_dispatcher_) { | 1192 if (!battery_status_dispatcher_) { |
1196 battery_status_dispatcher_.reset( | 1193 battery_status_dispatcher_.reset( |
1197 new BatteryStatusDispatcher(RenderThreadImpl::current())); | 1194 new BatteryStatusDispatcher(RenderThreadImpl::current())); |
1198 } | 1195 } |
1199 battery_status_dispatcher_->SetListener(listener); | 1196 battery_status_dispatcher_->SetListener(listener); |
1200 } | 1197 } |
1201 | 1198 |
1202 } // namespace content | 1199 } // namespace content |
OLD | NEW |