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

Side by Side Diff: components/test_runner/mock_screen_orientation_client.cc

Issue 1711083002: [DevTools] Move screen orientation override to RenderWidgetScreenMetricsEmulator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/test_runner/mock_screen_orientation_client.h" 5 #include "components/test_runner/mock_screen_orientation_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "third_party/WebKit/public/web/WebLocalFrame.h" 10 #include "third_party/WebKit/public/web/WebLocalFrame.h"
11 11
12 namespace test_runner { 12 namespace test_runner {
13 13
14 MockScreenOrientationClient::MockScreenOrientationClient() 14 MockScreenOrientationClient::MockScreenOrientationClient()
15 : main_frame_(NULL), 15 : main_frame_(NULL),
16 current_lock_(blink::WebScreenOrientationLockDefault), 16 current_lock_(blink::WebScreenOrientationLockDefault),
17 device_orientation_(blink::WebScreenOrientationPortraitPrimary), 17 device_orientation_(blink::WebScreenOrientationPortraitPrimary),
18 current_orientation_(blink::WebScreenOrientationPortraitPrimary) { 18 current_orientation_(blink::WebScreenOrientationPortraitPrimary),
19 is_active_(false) {
19 } 20 }
20 21
21 MockScreenOrientationClient::~MockScreenOrientationClient() { 22 MockScreenOrientationClient::~MockScreenOrientationClient() {
22 } 23 }
23 24
24 void MockScreenOrientationClient::ResetData() { 25 void MockScreenOrientationClient::ResetData() {
25 current_lock_ = blink::WebScreenOrientationLockDefault; 26 current_lock_ = blink::WebScreenOrientationLockDefault;
26 device_orientation_ = blink::WebScreenOrientationPortraitPrimary; 27 device_orientation_ = blink::WebScreenOrientationPortraitPrimary;
27 current_orientation_ = blink::WebScreenOrientationPortraitPrimary; 28 current_orientation_ = blink::WebScreenOrientationPortraitPrimary;
29 is_active_ = true;
28 } 30 }
29 31
30 void MockScreenOrientationClient::UpdateDeviceOrientation( 32 void MockScreenOrientationClient::UpdateDeviceOrientation(
31 blink::WebLocalFrame* main_frame, 33 blink::WebLocalFrame* main_frame,
32 blink::WebScreenOrientationType orientation) { 34 blink::WebScreenOrientationType orientation) {
33 main_frame_ = main_frame; 35 main_frame_ = main_frame;
36 is_active_ = true;
34 if (device_orientation_ == orientation) 37 if (device_orientation_ == orientation)
35 return; 38 return;
36 device_orientation_ = orientation; 39 device_orientation_ = orientation;
37 if (!IsOrientationAllowedByCurrentLock(orientation)) 40 if (!IsOrientationAllowedByCurrentLock(orientation))
38 return; 41 return;
39 UpdateScreenOrientation(orientation); 42 UpdateScreenOrientation(orientation);
40 } 43 }
41 44
42 void MockScreenOrientationClient::UpdateScreenOrientation( 45 void MockScreenOrientationClient::UpdateScreenOrientation(
43 blink::WebScreenOrientationType orientation) { 46 blink::WebScreenOrientationType orientation) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 case blink::WebScreenOrientationLockLandscape: 155 case blink::WebScreenOrientationLockLandscape:
153 return blink::WebScreenOrientationLandscapePrimary; 156 return blink::WebScreenOrientationLandscapePrimary;
154 case blink::WebScreenOrientationLockLandscapeSecondary: 157 case blink::WebScreenOrientationLockLandscapeSecondary:
155 return blink::WebScreenOrientationLandscapePrimary; 158 return blink::WebScreenOrientationLandscapePrimary;
156 default: 159 default:
157 return blink::WebScreenOrientationPortraitPrimary; 160 return blink::WebScreenOrientationPortraitPrimary;
158 } 161 }
159 } 162 }
160 163
161 } // namespace test_runner 164 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/mock_screen_orientation_client.h ('k') | components/test_runner/web_test_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698