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

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

Issue 2082333002: Remove calls to deprecated MessageLoop methods in components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 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 "base/single_thread_task_runner.h"
10 #include "third_party/WebKit/public/web/WebLocalFrame.h" 11 #include "third_party/WebKit/public/web/WebLocalFrame.h"
11 12
12 namespace test_runner { 13 namespace test_runner {
13 14
14 MockScreenOrientationClient::MockScreenOrientationClient() 15 MockScreenOrientationClient::MockScreenOrientationClient()
15 : main_frame_(NULL), 16 : main_frame_(NULL),
16 current_lock_(blink::WebScreenOrientationLockDefault), 17 current_lock_(blink::WebScreenOrientationLockDefault),
17 device_orientation_(blink::WebScreenOrientationPortraitPrimary), 18 device_orientation_(blink::WebScreenOrientationPortraitPrimary),
18 current_orientation_(blink::WebScreenOrientationPortraitPrimary), 19 current_orientation_(blink::WebScreenOrientationPortraitPrimary),
19 is_disabled_(false) { 20 is_disabled_(false) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 blink::WebScreenOrientationLockLandscapeSecondary || 109 blink::WebScreenOrientationLockLandscapeSecondary ||
109 current_lock_ == blink::WebScreenOrientationLockLandscape; 110 current_lock_ == blink::WebScreenOrientationLockLandscape;
110 default: 111 default:
111 return false; 112 return false;
112 } 113 }
113 } 114 }
114 115
115 void MockScreenOrientationClient::lockOrientation( 116 void MockScreenOrientationClient::lockOrientation(
116 blink::WebScreenOrientationLockType orientation, 117 blink::WebScreenOrientationLockType orientation,
117 blink::WebLockOrientationCallback* callback) { 118 blink::WebLockOrientationCallback* callback) {
118 base::MessageLoop::current()->PostTask( 119 base::MessageLoop::current()->task_runner()->PostTask(
119 FROM_HERE, 120 FROM_HERE, base::Bind(&MockScreenOrientationClient::UpdateLockSync,
120 base::Bind(&MockScreenOrientationClient::UpdateLockSync, 121 base::Unretained(this), orientation, callback));
121 base::Unretained(this),
122 orientation,
123 callback));
124 } 122 }
125 123
126 void MockScreenOrientationClient::unlockOrientation() { 124 void MockScreenOrientationClient::unlockOrientation() {
127 base::MessageLoop::current()->PostTask( 125 base::MessageLoop::current()->task_runner()->PostTask(
128 FROM_HERE, 126 FROM_HERE, base::Bind(&MockScreenOrientationClient::ResetLockSync,
129 base::Bind(&MockScreenOrientationClient::ResetLockSync, 127 base::Unretained(this)));
130 base::Unretained(this)));
131 } 128 }
132 129
133 void MockScreenOrientationClient::UpdateLockSync( 130 void MockScreenOrientationClient::UpdateLockSync(
134 blink::WebScreenOrientationLockType lock, 131 blink::WebScreenOrientationLockType lock,
135 blink::WebLockOrientationCallback* callback) { 132 blink::WebLockOrientationCallback* callback) {
136 DCHECK(lock != blink::WebScreenOrientationLockDefault); 133 DCHECK(lock != blink::WebScreenOrientationLockDefault);
137 current_lock_ = lock; 134 current_lock_ = lock;
138 if (!IsOrientationAllowedByCurrentLock(current_orientation_)) 135 if (!IsOrientationAllowedByCurrentLock(current_orientation_))
139 UpdateScreenOrientation(SuitableOrientationForCurrentLock()); 136 UpdateScreenOrientation(SuitableOrientationForCurrentLock());
140 callback->onSuccess(); 137 callback->onSuccess();
(...skipping 17 matching lines...) Expand all
158 case blink::WebScreenOrientationLockLandscape: 155 case blink::WebScreenOrientationLockLandscape:
159 return blink::WebScreenOrientationLandscapePrimary; 156 return blink::WebScreenOrientationLandscapePrimary;
160 case blink::WebScreenOrientationLockLandscapeSecondary: 157 case blink::WebScreenOrientationLockLandscapeSecondary:
161 return blink::WebScreenOrientationLandscapePrimary; 158 return blink::WebScreenOrientationLandscapePrimary;
162 default: 159 default:
163 return blink::WebScreenOrientationPortraitPrimary; 160 return blink::WebScreenOrientationPortraitPrimary;
164 } 161 }
165 } 162 }
166 163
167 } // namespace test_runner 164 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698