| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/enrollment_screen.h" | 5 #include "chrome/browser/chromeos/login/enrollment/enrollment_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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 policy::AutoEnrollmentClient::CancelAutoEnrollment(); | 214 policy::AutoEnrollmentClient::CancelAutoEnrollment(); |
| 215 UMA(is_auto_enrollment() ? policy::kMetricEnrollmentAutoCancelled | 215 UMA(is_auto_enrollment() ? policy::kMetricEnrollmentAutoCancelled |
| 216 : policy::kMetricEnrollmentCancelled); | 216 : policy::kMetricEnrollmentCancelled); |
| 217 actor_->ResetAuth( | 217 actor_->ResetAuth( |
| 218 base::Bind(&ScreenObserver::OnExit, | 218 base::Bind(&ScreenObserver::OnExit, |
| 219 base::Unretained(get_screen_observer()), | 219 base::Unretained(get_screen_observer()), |
| 220 ScreenObserver::ENTERPRISE_ENROLLMENT_COMPLETED)); | 220 ScreenObserver::ENTERPRISE_ENROLLMENT_COMPLETED)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void EnrollmentScreen::OnConfirmationClosed() { | 223 void EnrollmentScreen::OnConfirmationClosed() { |
| 224 // If the machine has been put in KIOSK mode we have to restart the session | |
| 225 // here to go in the proper KIOSK mode login screen. | |
| 226 policy::BrowserPolicyConnectorChromeOS* connector = | |
| 227 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | |
| 228 if (connector->GetDeviceMode() == policy::DEVICE_MODE_RETAIL_KIOSK) { | |
| 229 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); | |
| 230 return; | |
| 231 } | |
| 232 | |
| 233 if (is_auto_enrollment() && | 224 if (is_auto_enrollment() && |
| 234 !enrollment_failed_once_ && | 225 !enrollment_failed_once_ && |
| 235 !user_.empty() && | 226 !user_.empty() && |
| 236 LoginUtils::IsWhitelisted(user_, NULL)) { | 227 LoginUtils::IsWhitelisted(user_, NULL)) { |
| 237 actor_->ShowLoginSpinnerScreen(); | 228 actor_->ShowLoginSpinnerScreen(); |
| 238 get_screen_observer()->OnExit( | 229 get_screen_observer()->OnExit( |
| 239 ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); | 230 ScreenObserver::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); |
| 240 } else { | 231 } else { |
| 241 actor_->ResetAuth( | 232 actor_->ResetAuth( |
| 242 base::Bind(&ScreenObserver::OnExit, | 233 base::Bind(&ScreenObserver::OnExit, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 253 LOG(ERROR) << "Trying to re-enroll to a different domain than " | 244 LOG(ERROR) << "Trying to re-enroll to a different domain than " |
| 254 << connector->GetEnterpriseDomain(); | 245 << connector->GetEnterpriseDomain(); |
| 255 UMAFailure(policy::kMetricEnrollmentWrongUserError); | 246 UMAFailure(policy::kMetricEnrollmentWrongUserError); |
| 256 actor_->ShowUIError( | 247 actor_->ShowUIError( |
| 257 EnrollmentScreenActor::UI_ERROR_DOMAIN_MISMATCH); | 248 EnrollmentScreenActor::UI_ERROR_DOMAIN_MISMATCH); |
| 258 return; | 249 return; |
| 259 } | 250 } |
| 260 | 251 |
| 261 policy::DeviceCloudPolicyInitializer::AllowedDeviceModes device_modes; | 252 policy::DeviceCloudPolicyInitializer::AllowedDeviceModes device_modes; |
| 262 device_modes[policy::DEVICE_MODE_ENTERPRISE] = true; | 253 device_modes[policy::DEVICE_MODE_ENTERPRISE] = true; |
| 263 device_modes[policy::DEVICE_MODE_RETAIL_KIOSK] = | |
| 264 enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_MANUAL; | |
| 265 connector->ScheduleServiceInitialization(0); | 254 connector->ScheduleServiceInitialization(0); |
| 266 | 255 |
| 267 policy::DeviceCloudPolicyInitializer* dcp_initializer = | 256 policy::DeviceCloudPolicyInitializer* dcp_initializer = |
| 268 connector->GetDeviceCloudPolicyInitializer(); | 257 connector->GetDeviceCloudPolicyInitializer(); |
| 269 CHECK(dcp_initializer); | 258 CHECK(dcp_initializer); |
| 270 dcp_initializer->StartEnrollment( | 259 dcp_initializer->StartEnrollment( |
| 271 enterprise_management::PolicyData::ENTERPRISE_MANAGED, | 260 enterprise_management::PolicyData::ENTERPRISE_MANAGED, |
| 272 connector->device_management_service(), | 261 connector->device_management_service(), |
| 273 token, is_auto_enrollment(), device_modes, | 262 token, is_auto_enrollment(), device_modes, |
| 274 base::Bind(&EnrollmentScreen::ReportEnrollmentStatus, | 263 base::Bind(&EnrollmentScreen::ReportEnrollmentStatus, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 sample = policy::kMetricEnrollmentAutoFailed; | 382 sample = policy::kMetricEnrollmentAutoFailed; |
| 394 UMA(sample); | 383 UMA(sample); |
| 395 } | 384 } |
| 396 | 385 |
| 397 void EnrollmentScreen::ShowSigninScreen() { | 386 void EnrollmentScreen::ShowSigninScreen() { |
| 398 actor_->Show(); | 387 actor_->Show(); |
| 399 actor_->ShowSigninScreen(); | 388 actor_->ShowSigninScreen(); |
| 400 } | 389 } |
| 401 | 390 |
| 402 } // namespace chromeos | 391 } // namespace chromeos |
| OLD | NEW |