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/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
13 #include "base/numerics/safe_conversions.h" | 14 #include "base/numerics/safe_conversions.h" |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "content/child/blink_glue.h" | 17 #include "content/child/blink_glue.h" |
17 #include "content/child/database_util.h" | 18 #include "content/child/database_util.h" |
18 #include "content/child/fileapi/webfilesystem_impl.h" | 19 #include "content/child/fileapi/webfilesystem_impl.h" |
19 #include "content/child/indexed_db/webidbfactory_impl.h" | 20 #include "content/child/indexed_db/webidbfactory_impl.h" |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 | 1077 |
1077 // static | 1078 // static |
1078 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting( | 1079 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting( |
1079 const blink::WebDeviceMotionData& data) { | 1080 const blink::WebDeviceMotionData& data) { |
1080 g_test_device_motion_data.Get() = data; | 1081 g_test_device_motion_data.Get() = data; |
1081 } | 1082 } |
1082 | 1083 |
1083 // static | 1084 // static |
1084 void RendererWebKitPlatformSupportImpl::ResetMockScreenOrientationForTesting() | 1085 void RendererWebKitPlatformSupportImpl::ResetMockScreenOrientationForTesting() |
1085 { | 1086 { |
1086 g_test_screen_orientation_controller.Get().ResetData(); | 1087 if (!(g_test_screen_orientation_controller == 0)) |
| 1088 g_test_screen_orientation_controller.Get().ResetData(); |
1087 } | 1089 } |
1088 | 1090 |
1089 //------------------------------------------------------------------------------ | 1091 //------------------------------------------------------------------------------ |
1090 | 1092 |
1091 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener( | 1093 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener( |
1092 blink::WebDeviceOrientationListener* listener) { | 1094 blink::WebDeviceOrientationListener* listener) { |
1093 if (g_test_device_orientation_data == 0) { | 1095 if (g_test_device_orientation_data == 0) { |
1094 if (!device_orientation_event_pump_) { | 1096 if (!device_orientation_event_pump_) { |
1095 device_orientation_event_pump_.reset(new DeviceOrientationEventPump); | 1097 device_orientation_event_pump_.reset(new DeviceOrientationEventPump); |
1096 device_orientation_event_pump_->Attach(RenderThreadImpl::current()); | 1098 device_orientation_event_pump_->Attach(RenderThreadImpl::current()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 g_test_screen_orientation_controller.Get().ResetLock(); | 1172 g_test_screen_orientation_controller.Get().ResetLock(); |
1171 return; | 1173 return; |
1172 } | 1174 } |
1173 | 1175 |
1174 EnsureScreenOrientationDispatcher(); | 1176 EnsureScreenOrientationDispatcher(); |
1175 screen_orientation_dispatcher_->UnlockOrientation(); | 1177 screen_orientation_dispatcher_->UnlockOrientation(); |
1176 } | 1178 } |
1177 | 1179 |
1178 // static | 1180 // static |
1179 void RendererWebKitPlatformSupportImpl::SetMockScreenOrientationForTesting( | 1181 void RendererWebKitPlatformSupportImpl::SetMockScreenOrientationForTesting( |
| 1182 RenderView* render_view, |
1180 blink::WebScreenOrientationType orientation) { | 1183 blink::WebScreenOrientationType orientation) { |
1181 g_test_screen_orientation_controller.Get() | 1184 g_test_screen_orientation_controller.Get() |
1182 .UpdateDeviceOrientation(orientation); | 1185 .UpdateDeviceOrientation(render_view, orientation); |
1183 } | 1186 } |
1184 | 1187 |
1185 //------------------------------------------------------------------------------ | 1188 //------------------------------------------------------------------------------ |
1186 | 1189 |
1187 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( | 1190 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( |
1188 const blink::WebURL& storage_partition, | 1191 const blink::WebURL& storage_partition, |
1189 blink::WebStorageQuotaType type, | 1192 blink::WebStorageQuotaType type, |
1190 blink::WebStorageQuotaCallbacks callbacks) { | 1193 blink::WebStorageQuotaCallbacks callbacks) { |
1191 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) | 1194 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) |
1192 return; | 1195 return; |
(...skipping 25 matching lines...) Expand all Loading... |
1218 battery_status_dispatcher_->SetListener(listener); | 1221 battery_status_dispatcher_->SetListener(listener); |
1219 } | 1222 } |
1220 | 1223 |
1221 // static | 1224 // static |
1222 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1225 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
1223 const blink::WebBatteryStatus& status) { | 1226 const blink::WebBatteryStatus& status) { |
1224 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1227 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
1225 } | 1228 } |
1226 | 1229 |
1227 } // namespace content | 1230 } // namespace content |
OLD | NEW |