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

Side by Side Diff: chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.cc

Issue 2033753002: Remove use of deprecated MessageLoop methods in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: manual change 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 "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen. h" 5 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen. h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread_task_runner_handle.h"
11 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" 14 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h"
12 #include "chrome/browser/chromeos/login/screen_manager.h" 15 #include "chrome/browser/chromeos/login/screen_manager.h"
13 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" 16 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h"
14 #include "chrome/browser/chromeos/login/screens/error_screen.h" 17 #include "chrome/browser/chromeos/login/screens/error_screen.h"
15 #include "chrome/browser/chromeos/login/screens/network_error.h" 18 #include "chrome/browser/chromeos/login/screens/network_error.h"
16 #include "chrome/browser/chromeos/login/wizard_controller.h" 19 #include "chrome/browser/chromeos/login/wizard_controller.h"
17 #include "chromeos/chromeos_switches.h" 20 #include "chromeos/chromeos_switches.h"
18 #include "chromeos/network/network_state.h" 21 #include "chromeos/network/network_state.h"
19 #include "chromeos/network/network_state_handler.h" 22 #include "chromeos/network/network_state_handler.h"
20 23
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 histogram_helper_->OnErrorShow(error_state); 245 histogram_helper_->OnErrorShow(error_state);
243 } 246 }
244 247
245 void AutoEnrollmentCheckScreen::SignalCompletion() { 248 void AutoEnrollmentCheckScreen::SignalCompletion() {
246 network_portal_detector::GetInstance()->RemoveObserver(this); 249 network_portal_detector::GetInstance()->RemoveObserver(this);
247 auto_enrollment_progress_subscription_.reset(); 250 auto_enrollment_progress_subscription_.reset();
248 connect_request_subscription_.reset(); 251 connect_request_subscription_.reset();
249 252
250 // Calling Finish() can cause |this| destruction, so let other methods finish 253 // Calling Finish() can cause |this| destruction, so let other methods finish
251 // their work before. 254 // their work before.
252 base::MessageLoop::current()->PostTask( 255 base::ThreadTaskRunnerHandle::Get()->PostTask(
253 FROM_HERE, 256 FROM_HERE,
254 base::Bind( 257 base::Bind(
255 &AutoEnrollmentCheckScreen::Finish, weak_ptr_factory_.GetWeakPtr(), 258 &AutoEnrollmentCheckScreen::Finish, weak_ptr_factory_.GetWeakPtr(),
256 BaseScreenDelegate::ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED)); 259 BaseScreenDelegate::ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED));
257 } 260 }
258 261
259 bool AutoEnrollmentCheckScreen::IsCompleted() const { 262 bool AutoEnrollmentCheckScreen::IsCompleted() const {
260 switch (auto_enrollment_controller_->state()) { 263 switch (auto_enrollment_controller_->state()) {
261 case policy::AUTO_ENROLLMENT_STATE_IDLE: 264 case policy::AUTO_ENROLLMENT_STATE_IDLE:
262 case policy::AUTO_ENROLLMENT_STATE_PENDING: 265 case policy::AUTO_ENROLLMENT_STATE_PENDING:
263 case policy::AUTO_ENROLLMENT_STATE_CONNECTION_ERROR: 266 case policy::AUTO_ENROLLMENT_STATE_CONNECTION_ERROR:
264 return false; 267 return false;
265 case policy::AUTO_ENROLLMENT_STATE_SERVER_ERROR: 268 case policy::AUTO_ENROLLMENT_STATE_SERVER_ERROR:
266 // Server errors don't block OOBE. 269 // Server errors don't block OOBE.
267 case policy::AUTO_ENROLLMENT_STATE_TRIGGER_ENROLLMENT: 270 case policy::AUTO_ENROLLMENT_STATE_TRIGGER_ENROLLMENT:
268 case policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT: 271 case policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT:
269 // Decision made, ready to proceed. 272 // Decision made, ready to proceed.
270 return true; 273 return true;
271 } 274 }
272 NOTREACHED(); 275 NOTREACHED();
273 return false; 276 return false;
274 } 277 }
275 278
276 void AutoEnrollmentCheckScreen::OnConnectRequested() { 279 void AutoEnrollmentCheckScreen::OnConnectRequested() {
277 auto_enrollment_controller_->Retry(); 280 auto_enrollment_controller_->Retry();
278 } 281 }
279 282
280 } // namespace chromeos 283 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698