| 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/wizard_controller.h" | 5 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 screen_parameters_->GetBoolean("is_auto_enrollment", &is_auto_enrollment); | 490 screen_parameters_->GetBoolean("is_auto_enrollment", &is_auto_enrollment); |
| 491 screen_parameters_->GetString("user", &user); | 491 screen_parameters_->GetString("user", &user); |
| 492 } | 492 } |
| 493 | 493 |
| 494 EnrollmentScreenActor::EnrollmentMode mode = | 494 EnrollmentScreenActor::EnrollmentMode mode = |
| 495 EnrollmentScreenActor::ENROLLMENT_MODE_MANUAL; | 495 EnrollmentScreenActor::ENROLLMENT_MODE_MANUAL; |
| 496 if (is_auto_enrollment) | 496 if (is_auto_enrollment) |
| 497 mode = EnrollmentScreenActor::ENROLLMENT_MODE_AUTO; | 497 mode = EnrollmentScreenActor::ENROLLMENT_MODE_AUTO; |
| 498 else if (ShouldAutoStartEnrollment() && !CanExitEnrollment()) | 498 else if (ShouldAutoStartEnrollment() && !CanExitEnrollment()) |
| 499 mode = EnrollmentScreenActor::ENROLLMENT_MODE_FORCED; | 499 mode = EnrollmentScreenActor::ENROLLMENT_MODE_FORCED; |
| 500 else if (ShouldRecoverEnrollment()) |
| 501 mode = EnrollmentScreenActor::ENROLLMENT_MODE_FORCED; |
| 500 | 502 |
| 501 EnrollmentScreen* screen = GetEnrollmentScreen(); | 503 EnrollmentScreen* screen = GetEnrollmentScreen(); |
| 502 screen->SetParameters(mode, GetForcedEnrollmentDomain(), user); | 504 screen->SetParameters(mode, GetForcedEnrollmentDomain(), user); |
| 503 SetCurrentScreen(screen); | 505 SetCurrentScreen(screen); |
| 504 } | 506 } |
| 505 | 507 |
| 506 void WizardController::ShowResetScreen() { | 508 void WizardController::ShowResetScreen() { |
| 507 VLOG(1) << "Showing reset screen."; | 509 VLOG(1) << "Showing reset screen."; |
| 508 SetStatusAreaVisible(false); | 510 SetStatusAreaVisible(false); |
| 509 SetCurrentScreen(GetResetScreen()); | 511 SetCurrentScreen(GetResetScreen()); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 host_ = NULL; | 724 host_ = NULL; |
| 723 } | 725 } |
| 724 | 726 |
| 725 void WizardController::OnUserImageSkipped() { | 727 void WizardController::OnUserImageSkipped() { |
| 726 OnUserImageSelected(); | 728 OnUserImageSelected(); |
| 727 } | 729 } |
| 728 | 730 |
| 729 void WizardController::OnEnrollmentDone() { | 731 void WizardController::OnEnrollmentDone() { |
| 730 // Mark OOBE as completed only if enterprise enrollment was part of the | 732 // Mark OOBE as completed only if enterprise enrollment was part of the |
| 731 // forced flow (i.e. app kiosk). | 733 // forced flow (i.e. app kiosk). |
| 732 if (ShouldAutoStartEnrollment()) | 734 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) |
| 733 PerformOOBECompletedActions(); | 735 PerformOOBECompletedActions(); |
| 734 | 736 |
| 735 // TODO(mnissler): Unify the logic for auto-login for Public Sessions and | 737 // TODO(mnissler): Unify the logic for auto-login for Public Sessions and |
| 736 // Kiosk Apps and make this code cover both cases: http://crbug.com/234694. | 738 // Kiosk Apps and make this code cover both cases: http://crbug.com/234694. |
| 737 if (KioskAppManager::Get()->IsAutoLaunchEnabled()) | 739 if (KioskAppManager::Get()->IsAutoLaunchEnabled()) |
| 738 AutoLaunchKioskApp(); | 740 AutoLaunchKioskApp(); |
| 739 else | 741 else |
| 740 ShowLoginScreen(LoginScreenContext()); | 742 ShowLoginScreen(LoginScreenContext()); |
| 741 } | 743 } |
| 742 | 744 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 767 else | 769 else |
| 768 ShowLoginScreen(LoginScreenContext()); | 770 ShowLoginScreen(LoginScreenContext()); |
| 769 } | 771 } |
| 770 | 772 |
| 771 void WizardController::OnAutoEnrollmentDone() { | 773 void WizardController::OnAutoEnrollmentDone() { |
| 772 VLOG(1) << "Automagic enrollment done, resuming previous signin"; | 774 VLOG(1) << "Automagic enrollment done, resuming previous signin"; |
| 773 ResumeLoginScreen(); | 775 ResumeLoginScreen(); |
| 774 } | 776 } |
| 775 | 777 |
| 776 void WizardController::OnOOBECompleted() { | 778 void WizardController::OnOOBECompleted() { |
| 777 if (ShouldAutoStartEnrollment()) { | 779 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) { |
| 778 ShowEnrollmentScreen(); | 780 ShowEnrollmentScreen(); |
| 779 } else { | 781 } else { |
| 780 PerformOOBECompletedActions(); | 782 PerformOOBECompletedActions(); |
| 781 ShowLoginScreen(LoginScreenContext()); | 783 ShowLoginScreen(LoginScreenContext()); |
| 782 } | 784 } |
| 783 } | 785 } |
| 784 | 786 |
| 785 void WizardController::OnTermsOfServiceDeclined() { | 787 void WizardController::OnTermsOfServiceDeclined() { |
| 786 // If the user declines the Terms of Service, end the session and return to | 788 // If the user declines the Terms of Service, end the session and return to |
| 787 // the login screen. | 789 // the login screen. |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 // static | 1126 // static |
| 1125 bool WizardController::ShouldAutoStartEnrollment() { | 1127 bool WizardController::ShouldAutoStartEnrollment() { |
| 1126 policy::BrowserPolicyConnectorChromeOS* connector = | 1128 policy::BrowserPolicyConnectorChromeOS* connector = |
| 1127 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 1129 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 1128 policy::DeviceCloudPolicyInitializer* dcp_initializer = | 1130 policy::DeviceCloudPolicyInitializer* dcp_initializer = |
| 1129 connector->GetDeviceCloudPolicyInitializer(); | 1131 connector->GetDeviceCloudPolicyInitializer(); |
| 1130 return dcp_initializer && dcp_initializer->ShouldAutoStartEnrollment(); | 1132 return dcp_initializer && dcp_initializer->ShouldAutoStartEnrollment(); |
| 1131 } | 1133 } |
| 1132 | 1134 |
| 1133 // static | 1135 // static |
| 1136 bool WizardController::ShouldRecoverEnrollment() { |
| 1137 policy::BrowserPolicyConnectorChromeOS* connector = |
| 1138 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 1139 policy::DeviceCloudPolicyInitializer* dcp_initializer = |
| 1140 connector->GetDeviceCloudPolicyInitializer(); |
| 1141 return dcp_initializer && dcp_initializer->ShouldRecoverEnrollment(); |
| 1142 } |
| 1143 |
| 1144 // static |
| 1134 bool WizardController::CanExitEnrollment() { | 1145 bool WizardController::CanExitEnrollment() { |
| 1135 policy::BrowserPolicyConnectorChromeOS* connector = | 1146 policy::BrowserPolicyConnectorChromeOS* connector = |
| 1136 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 1147 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 1137 CHECK(connector); | 1148 CHECK(connector); |
| 1138 return connector->GetDeviceCloudPolicyInitializer()->CanExitEnrollment(); | 1149 return connector->GetDeviceCloudPolicyInitializer()->CanExitEnrollment(); |
| 1139 } | 1150 } |
| 1140 | 1151 |
| 1141 // static | 1152 // static |
| 1142 std::string WizardController::GetForcedEnrollmentDomain() { | 1153 std::string WizardController::GetForcedEnrollmentDomain() { |
| 1143 policy::BrowserPolicyConnectorChromeOS* connector = | 1154 policy::BrowserPolicyConnectorChromeOS* connector = |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 bool WizardController::SetOnTimeZoneResolvedForTesting( | 1256 bool WizardController::SetOnTimeZoneResolvedForTesting( |
| 1246 const base::Closure& callback) { | 1257 const base::Closure& callback) { |
| 1247 if (timezone_resolved_) | 1258 if (timezone_resolved_) |
| 1248 return false; | 1259 return false; |
| 1249 | 1260 |
| 1250 on_timezone_resolved_for_testing_ = callback; | 1261 on_timezone_resolved_for_testing_ = callback; |
| 1251 return true; | 1262 return true; |
| 1252 } | 1263 } |
| 1253 | 1264 |
| 1254 } // namespace chromeos | 1265 } // namespace chromeos |
| OLD | NEW |