Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 302553007: Call RenderViewImpl::SetScreenOrientationForTesting to make sure that events are not sent when orie… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated by review comments. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 1073
1074 // static 1074 // static
1075 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting( 1075 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting(
1076 const blink::WebDeviceMotionData& data) { 1076 const blink::WebDeviceMotionData& data) {
1077 g_test_device_motion_data.Get() = data; 1077 g_test_device_motion_data.Get() = data;
1078 } 1078 }
1079 1079
1080 // static 1080 // static
1081 void RendererWebKitPlatformSupportImpl::ResetMockScreenOrientationForTesting() 1081 void RendererWebKitPlatformSupportImpl::ResetMockScreenOrientationForTesting()
1082 { 1082 {
1083 assert(!(g_test_screen_orientation_controller == 0));
jochen (gone - plz use gerrit) 2014/06/02 07:21:25 DCHECK(g_test_screen_orientation_controller)
ostap 2014/06/03 00:11:54 LazyInstance implements only == operator, so it ha
1083 g_test_screen_orientation_controller.Get().ResetData(); 1084 g_test_screen_orientation_controller.Get().ResetData();
jochen (gone - plz use gerrit) 2014/06/02 07:21:25 .Get() will create an controller btw
ostap 2014/06/03 00:11:54 Yes. ResetMockScreenOrientationForTesting() should
1084 } 1085 }
1085 1086
1086 //------------------------------------------------------------------------------ 1087 //------------------------------------------------------------------------------
1087 1088
1088 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener( 1089 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener(
1089 blink::WebDeviceOrientationListener* listener) { 1090 blink::WebDeviceOrientationListener* listener) {
1090 if (g_test_device_orientation_data == 0) { 1091 if (g_test_device_orientation_data == 0) {
1091 if (!device_orientation_event_pump_) { 1092 if (!device_orientation_event_pump_) {
1092 device_orientation_event_pump_.reset(new DeviceOrientationEventPump); 1093 device_orientation_event_pump_.reset(new DeviceOrientationEventPump);
1093 device_orientation_event_pump_->Attach(RenderThreadImpl::current()); 1094 device_orientation_event_pump_->Attach(RenderThreadImpl::current());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 if (RenderThreadImpl::current() && 1158 if (RenderThreadImpl::current() &&
1158 RenderThreadImpl::current()->layout_test_mode()) { 1159 RenderThreadImpl::current()->layout_test_mode()) {
1159 g_test_screen_orientation_controller.Get().ResetLock(); 1160 g_test_screen_orientation_controller.Get().ResetLock();
1160 return; 1161 return;
1161 } 1162 }
1162 RenderThread::Get()->Send(new ScreenOrientationHostMsg_Unlock); 1163 RenderThread::Get()->Send(new ScreenOrientationHostMsg_Unlock);
1163 } 1164 }
1164 1165
1165 // static 1166 // static
1166 void RendererWebKitPlatformSupportImpl::SetMockScreenOrientationForTesting( 1167 void RendererWebKitPlatformSupportImpl::SetMockScreenOrientationForTesting(
1168 RenderView* render_view,
1167 blink::WebScreenOrientationType orientation) { 1169 blink::WebScreenOrientationType orientation) {
1168 g_test_screen_orientation_controller.Get() 1170 g_test_screen_orientation_controller.Get()
1169 .UpdateDeviceOrientation(orientation); 1171 .UpdateDeviceOrientation(render_view, orientation);
1170 } 1172 }
1171 1173
1172 //------------------------------------------------------------------------------ 1174 //------------------------------------------------------------------------------
1173 1175
1174 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( 1176 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota(
1175 const blink::WebURL& storage_partition, 1177 const blink::WebURL& storage_partition,
1176 blink::WebStorageQuotaType type, 1178 blink::WebStorageQuotaType type,
1177 blink::WebStorageQuotaCallbacks callbacks) { 1179 blink::WebStorageQuotaCallbacks callbacks) {
1178 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) 1180 if (!thread_safe_sender_.get() || !quota_message_filter_.get())
1179 return; 1181 return;
(...skipping 10 matching lines...) Expand all
1190 void RendererWebKitPlatformSupportImpl::setBatteryStatusListener( 1192 void RendererWebKitPlatformSupportImpl::setBatteryStatusListener(
1191 blink::WebBatteryStatusListener* listener) { 1193 blink::WebBatteryStatusListener* listener) {
1192 if (!battery_status_dispatcher_) { 1194 if (!battery_status_dispatcher_) {
1193 battery_status_dispatcher_.reset( 1195 battery_status_dispatcher_.reset(
1194 new BatteryStatusDispatcher(RenderThreadImpl::current())); 1196 new BatteryStatusDispatcher(RenderThreadImpl::current()));
1195 } 1197 }
1196 battery_status_dispatcher_->SetListener(listener); 1198 battery_status_dispatcher_->SetListener(listener);
1197 } 1199 }
1198 1200
1199 } // namespace content 1201 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698