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

Side by Side Diff: content/shell/renderer/test_runner/mock_screen_orientation_client.cc

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 "content/shell/renderer/test_runner/mock_screen_orientation_client.h" 5 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h"
10 #include "third_party/WebKit/public/web/WebLocalFrame.h" 12 #include "third_party/WebKit/public/web/WebLocalFrame.h"
11 13
12 namespace content { 14 namespace content {
13 15
14 MockScreenOrientationClient::MockScreenOrientationClient() 16 MockScreenOrientationClient::MockScreenOrientationClient()
15 : main_frame_(NULL), 17 : main_frame_(NULL),
16 current_lock_(blink::WebScreenOrientationLockDefault), 18 current_lock_(blink::WebScreenOrientationLockDefault),
17 device_orientation_(blink::WebScreenOrientationPortraitPrimary), 19 device_orientation_(blink::WebScreenOrientationPortraitPrimary),
18 current_orientation_(blink::WebScreenOrientationPortraitPrimary) { 20 current_orientation_(blink::WebScreenOrientationPortraitPrimary) {
19 } 21 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 blink::WebScreenOrientationLockLandscapeSecondary || 104 blink::WebScreenOrientationLockLandscapeSecondary ||
103 current_lock_ == blink::WebScreenOrientationLockLandscape; 105 current_lock_ == blink::WebScreenOrientationLockLandscape;
104 default: 106 default:
105 return false; 107 return false;
106 } 108 }
107 } 109 }
108 110
109 void MockScreenOrientationClient::lockOrientation( 111 void MockScreenOrientationClient::lockOrientation(
110 blink::WebScreenOrientationLockType orientation, 112 blink::WebScreenOrientationLockType orientation,
111 blink::WebLockOrientationCallback* callback) { 113 blink::WebLockOrientationCallback* callback) {
112 base::MessageLoop::current()->PostTask( 114 base::ThreadTaskRunnerHandle::Get()->PostTask(
113 FROM_HERE, 115 FROM_HERE, base::Bind(&MockScreenOrientationClient::UpdateLockSync,
114 base::Bind(&MockScreenOrientationClient::UpdateLockSync, 116 base::Unretained(this), orientation, callback));
115 base::Unretained(this),
116 orientation,
117 callback));
118 } 117 }
119 118
120 void MockScreenOrientationClient::unlockOrientation() { 119 void MockScreenOrientationClient::unlockOrientation() {
121 base::MessageLoop::current()->PostTask( 120 base::ThreadTaskRunnerHandle::Get()->PostTask(
122 FROM_HERE, 121 FROM_HERE, base::Bind(&MockScreenOrientationClient::ResetLockSync,
123 base::Bind(&MockScreenOrientationClient::ResetLockSync, 122 base::Unretained(this)));
124 base::Unretained(this)));
125 } 123 }
126 124
127 void MockScreenOrientationClient::UpdateLockSync( 125 void MockScreenOrientationClient::UpdateLockSync(
128 blink::WebScreenOrientationLockType lock, 126 blink::WebScreenOrientationLockType lock,
129 blink::WebLockOrientationCallback* callback) { 127 blink::WebLockOrientationCallback* callback) {
130 DCHECK(lock != blink::WebScreenOrientationLockDefault); 128 DCHECK(lock != blink::WebScreenOrientationLockDefault);
131 current_lock_ = lock; 129 current_lock_ = lock;
132 if (!IsOrientationAllowedByCurrentLock(current_orientation_)) 130 if (!IsOrientationAllowedByCurrentLock(current_orientation_))
133 UpdateScreenOrientation(SuitableOrientationForCurrentLock()); 131 UpdateScreenOrientation(SuitableOrientationForCurrentLock());
134 callback->onSuccess(); 132 callback->onSuccess();
(...skipping 17 matching lines...) Expand all
152 case blink::WebScreenOrientationLockLandscape: 150 case blink::WebScreenOrientationLockLandscape:
153 return blink::WebScreenOrientationLandscapePrimary; 151 return blink::WebScreenOrientationLandscapePrimary;
154 case blink::WebScreenOrientationLockLandscapeSecondary: 152 case blink::WebScreenOrientationLockLandscapeSecondary:
155 return blink::WebScreenOrientationLandscapePrimary; 153 return blink::WebScreenOrientationLandscapePrimary;
156 default: 154 default:
157 return blink::WebScreenOrientationPortraitPrimary; 155 return blink::WebScreenOrientationPortraitPrimary;
158 } 156 }
159 } 157 }
160 158
161 } // namespace content 159 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698