Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/location.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 policy::AutoEnrollmentState new_auto_enrollment_state = | 107 policy::AutoEnrollmentState new_auto_enrollment_state = |
| 108 auto_enrollment_controller_->state(); | 108 auto_enrollment_controller_->state(); |
| 109 | 109 |
| 110 if (!UpdateCaptivePortalStatus(new_captive_portal_status)) | 110 if (!UpdateCaptivePortalStatus(new_captive_portal_status)) |
| 111 UpdateAutoEnrollmentState(new_auto_enrollment_state); | 111 UpdateAutoEnrollmentState(new_auto_enrollment_state); |
| 112 | 112 |
| 113 captive_portal_status_ = new_captive_portal_status; | 113 captive_portal_status_ = new_captive_portal_status; |
| 114 auto_enrollment_state_ = new_auto_enrollment_state; | 114 auto_enrollment_state_ = new_auto_enrollment_state; |
| 115 | 115 |
| 116 // Make sure gears are in motion in the background. | 116 // Make sure gears are in motion in the background. |
| 117 auto_enrollment_controller_->Start(); | 117 if (auto_enrollment_controller_->state() == |
|
achuithb
2017/04/19 19:04:43
Why not do this state check inside Start()?
Thiemo Nagel
2017/04/20 13:24:00
Done.
| |
| 118 policy::AUTO_ENROLLMENT_STATE_IDLE) { | |
| 119 auto_enrollment_controller_->Start(); | |
| 120 } | |
| 118 network_portal_detector::GetInstance()->StartDetectionIfIdle(); | 121 network_portal_detector::GetInstance()->StartDetectionIfIdle(); |
| 119 } | 122 } |
| 120 | 123 |
| 121 void AutoEnrollmentCheckScreen::Hide() { | 124 void AutoEnrollmentCheckScreen::Hide() { |
| 122 } | 125 } |
| 123 | 126 |
| 124 void AutoEnrollmentCheckScreen::OnViewDestroyed( | 127 void AutoEnrollmentCheckScreen::OnViewDestroyed( |
| 125 AutoEnrollmentCheckScreenView* view) { | 128 AutoEnrollmentCheckScreenView* view) { |
| 126 if (view_ == view) | 129 if (view_ == view) |
| 127 view_ = nullptr; | 130 view_ = nullptr; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 | 201 |
| 199 // Return is required to avoid compiler warning. | 202 // Return is required to avoid compiler warning. |
| 200 NOTREACHED() << "Bad status " << new_captive_portal_status; | 203 NOTREACHED() << "Bad status " << new_captive_portal_status; |
| 201 return false; | 204 return false; |
| 202 } | 205 } |
| 203 | 206 |
| 204 bool AutoEnrollmentCheckScreen::UpdateAutoEnrollmentState( | 207 bool AutoEnrollmentCheckScreen::UpdateAutoEnrollmentState( |
| 205 policy::AutoEnrollmentState new_auto_enrollment_state) { | 208 policy::AutoEnrollmentState new_auto_enrollment_state) { |
| 206 switch (new_auto_enrollment_state) { | 209 switch (new_auto_enrollment_state) { |
| 207 case policy::AUTO_ENROLLMENT_STATE_IDLE: | 210 case policy::AUTO_ENROLLMENT_STATE_IDLE: |
| 208 // The client should have been started already. | |
| 209 NOTREACHED(); | |
| 210 return false; | |
| 211 case policy::AUTO_ENROLLMENT_STATE_PENDING: | 211 case policy::AUTO_ENROLLMENT_STATE_PENDING: |
| 212 case policy::AUTO_ENROLLMENT_STATE_SERVER_ERROR: | 212 case policy::AUTO_ENROLLMENT_STATE_SERVER_ERROR: |
| 213 case policy::AUTO_ENROLLMENT_STATE_TRIGGER_ENROLLMENT: | 213 case policy::AUTO_ENROLLMENT_STATE_TRIGGER_ENROLLMENT: |
| 214 case policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT: | 214 case policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT: |
| 215 return false; | 215 return false; |
| 216 case policy::AUTO_ENROLLMENT_STATE_CONNECTION_ERROR: | 216 case policy::AUTO_ENROLLMENT_STATE_CONNECTION_ERROR: |
| 217 ShowErrorScreen(NetworkError::ERROR_STATE_OFFLINE); | 217 ShowErrorScreen(NetworkError::ERROR_STATE_OFFLINE); |
| 218 return true; | 218 return true; |
| 219 } | 219 } |
| 220 | 220 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 } | 268 } |
| 269 NOTREACHED(); | 269 NOTREACHED(); |
| 270 return false; | 270 return false; |
| 271 } | 271 } |
| 272 | 272 |
| 273 void AutoEnrollmentCheckScreen::OnConnectRequested() { | 273 void AutoEnrollmentCheckScreen::OnConnectRequested() { |
| 274 auto_enrollment_controller_->Retry(); | 274 auto_enrollment_controller_->Retry(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace chromeos | 277 } // namespace chromeos |
| OLD | NEW |