| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 return true; | 173 return true; |
| 174 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL: | 174 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL: |
| 175 ShowErrorScreen(ErrorScreen::ERROR_STATE_PORTAL); | 175 ShowErrorScreen(ErrorScreen::ERROR_STATE_PORTAL); |
| 176 if (captive_portal_status_ != new_captive_portal_status) | 176 if (captive_portal_status_ != new_captive_portal_status) |
| 177 get_screen_observer()->GetErrorScreen()->FixCaptivePortal(); | 177 get_screen_observer()->GetErrorScreen()->FixCaptivePortal(); |
| 178 return true; | 178 return true; |
| 179 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: | 179 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: |
| 180 ShowErrorScreen(ErrorScreen::ERROR_STATE_PROXY); | 180 ShowErrorScreen(ErrorScreen::ERROR_STATE_PROXY); |
| 181 return true; | 181 return true; |
| 182 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT: | 182 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT: |
| 183 // Trigger NOTREACHED() below. | 183 NOTREACHED() << "Bad status: CAPTIVE_PORTAL_STATUS_COUNT"; |
| 184 break; | 184 return false; |
| 185 } | 185 } |
| 186 | 186 |
| 187 // Return is required to avoid compiler warning. |
| 187 NOTREACHED() << "Bad status " << new_captive_portal_status; | 188 NOTREACHED() << "Bad status " << new_captive_portal_status; |
| 188 return false; | 189 return false; |
| 189 } | 190 } |
| 190 | 191 |
| 191 bool AutoEnrollmentCheckScreen::UpdateAutoEnrollmentState( | 192 bool AutoEnrollmentCheckScreen::UpdateAutoEnrollmentState( |
| 192 policy::AutoEnrollmentState new_auto_enrollment_state) { | 193 policy::AutoEnrollmentState new_auto_enrollment_state) { |
| 193 switch (new_auto_enrollment_state) { | 194 switch (new_auto_enrollment_state) { |
| 194 case policy::AUTO_ENROLLMENT_STATE_IDLE: | 195 case policy::AUTO_ENROLLMENT_STATE_IDLE: |
| 195 // The client should have been started already. | 196 // The client should have been started already. |
| 196 NOTREACHED(); | 197 NOTREACHED(); |
| 197 return false; | 198 return false; |
| 198 case policy::AUTO_ENROLLMENT_STATE_PENDING: | 199 case policy::AUTO_ENROLLMENT_STATE_PENDING: |
| 199 case policy::AUTO_ENROLLMENT_STATE_SERVER_ERROR: | 200 case policy::AUTO_ENROLLMENT_STATE_SERVER_ERROR: |
| 200 case policy::AUTO_ENROLLMENT_STATE_TRIGGER_ENROLLMENT: | 201 case policy::AUTO_ENROLLMENT_STATE_TRIGGER_ENROLLMENT: |
| 201 case policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT: | 202 case policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT: |
| 202 return false; | 203 return false; |
| 203 case policy::AUTO_ENROLLMENT_STATE_CONNECTION_ERROR: | 204 case policy::AUTO_ENROLLMENT_STATE_CONNECTION_ERROR: |
| 204 ShowErrorScreen(ErrorScreen::ERROR_STATE_OFFLINE); | 205 ShowErrorScreen(ErrorScreen::ERROR_STATE_OFFLINE); |
| 205 return true; | 206 return true; |
| 206 } | 207 } |
| 207 | 208 |
| 209 // Return is required to avoid compiler warning. |
| 208 NOTREACHED() << "bad state " << new_auto_enrollment_state; | 210 NOTREACHED() << "bad state " << new_auto_enrollment_state; |
| 209 return false; | 211 return false; |
| 210 } | 212 } |
| 211 | 213 |
| 212 void AutoEnrollmentCheckScreen::ShowErrorScreen( | 214 void AutoEnrollmentCheckScreen::ShowErrorScreen( |
| 213 ErrorScreen::ErrorState error_state) { | 215 ErrorScreen::ErrorState error_state) { |
| 214 const NetworkState* network = | 216 const NetworkState* network = |
| 215 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); | 217 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); |
| 216 ErrorScreen* error_screen = get_screen_observer()->GetErrorScreen(); | 218 ErrorScreen* error_screen = get_screen_observer()->GetErrorScreen(); |
| 217 error_screen->SetUIState(ErrorScreen::UI_STATE_AUTO_ENROLLMENT_ERROR); | 219 error_screen->SetUIState(ErrorScreen::UI_STATE_AUTO_ENROLLMENT_ERROR); |
| 218 error_screen->AllowGuestSignin(true); | 220 error_screen->AllowGuestSignin(true); |
| 219 error_screen->SetErrorState(error_state, | 221 error_screen->SetErrorState(error_state, |
| 220 network ? network->name() : std::string()); | 222 network ? network->name() : std::string()); |
| 221 get_screen_observer()->ShowErrorScreen(); | 223 get_screen_observer()->ShowErrorScreen(); |
| 222 } | 224 } |
| 223 | 225 |
| 224 void AutoEnrollmentCheckScreen::SignalCompletion() { | 226 void AutoEnrollmentCheckScreen::SignalCompletion() { |
| 225 NetworkPortalDetector::Get()->RemoveObserver(this); | 227 NetworkPortalDetector::Get()->RemoveObserver(this); |
| 226 auto_enrollment_progress_subscription_.reset(); | 228 auto_enrollment_progress_subscription_.reset(); |
| 227 get_screen_observer()->OnExit( | 229 get_screen_observer()->OnExit( |
| 228 ScreenObserver::ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED); | 230 ScreenObserver::ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED); |
| 229 } | 231 } |
| 230 | 232 |
| 231 } // namespace chromeos | 233 } // namespace chromeos |
| OLD | NEW |