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