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 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/prefs/pref_registry_simple.h" | 17 #include "base/prefs/pref_registry_simple.h" |
18 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
20 #include "base/threading/thread_restrictions.h" | 20 #include "base/threading/thread_restrictions.h" |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 24 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
25 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 25 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
26 #include "chrome/browser/chromeos/customization_document.h" | 26 #include "chrome/browser/chromeos/customization_document.h" |
27 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" | 27 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" |
28 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_step.h" | 28 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.
h" |
29 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" | 29 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" |
30 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 30 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
31 #include "chrome/browser/chromeos/login/helper.h" | 31 #include "chrome/browser/chromeos/login/helper.h" |
32 #include "chrome/browser/chromeos/login/hwid_checker.h" | 32 #include "chrome/browser/chromeos/login/hwid_checker.h" |
33 #include "chrome/browser/chromeos/login/login_utils.h" | 33 #include "chrome/browser/chromeos/login/login_utils.h" |
34 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc
reen.h" | 34 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc
reen.h" |
35 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 35 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
36 #include "chrome/browser/chromeos/login/screens/eula_screen.h" | 36 #include "chrome/browser/chromeos/login/screens/eula_screen.h" |
37 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" | 37 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" |
38 #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h" | 38 #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 const char WizardController::kLoginScreenName[] = "login"; | 117 const char WizardController::kLoginScreenName[] = "login"; |
118 const char WizardController::kUpdateScreenName[] = "update"; | 118 const char WizardController::kUpdateScreenName[] = "update"; |
119 const char WizardController::kUserImageScreenName[] = "image"; | 119 const char WizardController::kUserImageScreenName[] = "image"; |
120 const char WizardController::kEulaScreenName[] = "eula"; | 120 const char WizardController::kEulaScreenName[] = "eula"; |
121 const char WizardController::kEnrollmentScreenName[] = "enroll"; | 121 const char WizardController::kEnrollmentScreenName[] = "enroll"; |
122 const char WizardController::kResetScreenName[] = "reset"; | 122 const char WizardController::kResetScreenName[] = "reset"; |
123 const char WizardController::kKioskEnableScreenName[] = "kiosk-enable"; | 123 const char WizardController::kKioskEnableScreenName[] = "kiosk-enable"; |
124 const char WizardController::kKioskAutolaunchScreenName[] = "autolaunch"; | 124 const char WizardController::kKioskAutolaunchScreenName[] = "autolaunch"; |
125 const char WizardController::kErrorScreenName[] = "error-message"; | 125 const char WizardController::kErrorScreenName[] = "error-message"; |
126 const char WizardController::kTermsOfServiceScreenName[] = "tos"; | 126 const char WizardController::kTermsOfServiceScreenName[] = "tos"; |
| 127 const char WizardController::kAutoEnrollmentCheckScreenName[] = |
| 128 "auto-enrollment-check"; |
127 const char WizardController::kWrongHWIDScreenName[] = "wrong-hwid"; | 129 const char WizardController::kWrongHWIDScreenName[] = "wrong-hwid"; |
128 const char WizardController::kLocallyManagedUserCreationScreenName[] = | 130 const char WizardController::kLocallyManagedUserCreationScreenName[] = |
129 "locally-managed-user-creation-flow"; | 131 "locally-managed-user-creation-flow"; |
130 const char WizardController::kAppLaunchSplashScreenName[] = | 132 const char WizardController::kAppLaunchSplashScreenName[] = |
131 "app-launch-splash"; | 133 "app-launch-splash"; |
132 const char WizardController::kHIDDetectionScreenName[] = "hid-detection"; | 134 const char WizardController::kHIDDetectionScreenName[] = "hid-detection"; |
133 | 135 |
134 // static | 136 // static |
135 const int WizardController::kMinAudibleOutputVolumePercent = 10; | 137 const int WizardController::kMinAudibleOutputVolumePercent = 10; |
136 | 138 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 320 |
319 chromeos::WrongHWIDScreen* WizardController::GetWrongHWIDScreen() { | 321 chromeos::WrongHWIDScreen* WizardController::GetWrongHWIDScreen() { |
320 if (!wrong_hwid_screen_.get()) { | 322 if (!wrong_hwid_screen_.get()) { |
321 wrong_hwid_screen_.reset( | 323 wrong_hwid_screen_.reset( |
322 new chromeos::WrongHWIDScreen( | 324 new chromeos::WrongHWIDScreen( |
323 this, oobe_display_->GetWrongHWIDScreenActor())); | 325 this, oobe_display_->GetWrongHWIDScreenActor())); |
324 } | 326 } |
325 return wrong_hwid_screen_.get(); | 327 return wrong_hwid_screen_.get(); |
326 } | 328 } |
327 | 329 |
| 330 chromeos::AutoEnrollmentCheckScreen* |
| 331 WizardController::GetAutoEnrollmentCheckScreen() { |
| 332 if (!auto_enrollment_check_screen_.get()) { |
| 333 auto_enrollment_check_screen_.reset( |
| 334 new chromeos::AutoEnrollmentCheckScreen( |
| 335 this, |
| 336 oobe_display_->GetAutoEnrollmentCheckScreenActor(), |
| 337 host_->GetAutoEnrollmentController())); |
| 338 } |
| 339 return auto_enrollment_check_screen_.get(); |
| 340 } |
| 341 |
328 chromeos::LocallyManagedUserCreationScreen* | 342 chromeos::LocallyManagedUserCreationScreen* |
329 WizardController::GetLocallyManagedUserCreationScreen() { | 343 WizardController::GetLocallyManagedUserCreationScreen() { |
330 if (!locally_managed_user_creation_screen_.get()) { | 344 if (!locally_managed_user_creation_screen_.get()) { |
331 locally_managed_user_creation_screen_.reset( | 345 locally_managed_user_creation_screen_.reset( |
332 new chromeos::LocallyManagedUserCreationScreen( | 346 new chromeos::LocallyManagedUserCreationScreen( |
333 this, oobe_display_->GetLocallyManagedUserCreationScreenActor())); | 347 this, oobe_display_->GetLocallyManagedUserCreationScreenActor())); |
334 } | 348 } |
335 return locally_managed_user_creation_screen_.get(); | 349 return locally_managed_user_creation_screen_.get(); |
336 } | 350 } |
337 | 351 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 SetStatusAreaVisible(true); | 487 SetStatusAreaVisible(true); |
474 SetCurrentScreen(GetTermsOfServiceScreen()); | 488 SetCurrentScreen(GetTermsOfServiceScreen()); |
475 } | 489 } |
476 | 490 |
477 void WizardController::ShowWrongHWIDScreen() { | 491 void WizardController::ShowWrongHWIDScreen() { |
478 VLOG(1) << "Showing wrong HWID screen."; | 492 VLOG(1) << "Showing wrong HWID screen."; |
479 SetStatusAreaVisible(false); | 493 SetStatusAreaVisible(false); |
480 SetCurrentScreen(GetWrongHWIDScreen()); | 494 SetCurrentScreen(GetWrongHWIDScreen()); |
481 } | 495 } |
482 | 496 |
| 497 void WizardController::ShowAutoEnrollmentCheckScreen() { |
| 498 VLOG(1) << "Showing Auto-enrollment check screen."; |
| 499 SetStatusAreaVisible(true); |
| 500 SetCurrentScreen(GetAutoEnrollmentCheckScreen()); |
| 501 } |
| 502 |
483 void WizardController::ShowLocallyManagedUserCreationScreen() { | 503 void WizardController::ShowLocallyManagedUserCreationScreen() { |
484 VLOG(1) << "Showing Locally managed user creation screen screen."; | 504 VLOG(1) << "Showing Locally managed user creation screen screen."; |
485 SetStatusAreaVisible(true); | 505 SetStatusAreaVisible(true); |
486 LocallyManagedUserCreationScreen* screen = | 506 LocallyManagedUserCreationScreen* screen = |
487 GetLocallyManagedUserCreationScreen(); | 507 GetLocallyManagedUserCreationScreen(); |
488 SetCurrentScreen(screen); | 508 SetCurrentScreen(screen); |
489 } | 509 } |
490 | 510 |
491 void WizardController::ShowHIDDetectionScreen() { | 511 void WizardController::ShowHIDDetectionScreen() { |
492 VLOG(1) << "Showing HID discovery screen."; | 512 VLOG(1) << "Showing HID discovery screen."; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 // should report some error message here and stay on the same screen. | 570 // should report some error message here and stay on the same screen. |
551 ShowLoginScreen(LoginScreenContext()); | 571 ShowLoginScreen(LoginScreenContext()); |
552 } | 572 } |
553 | 573 |
554 void WizardController::OnConnectionFailed() { | 574 void WizardController::OnConnectionFailed() { |
555 // TODO(dpolukhin): show error message after login screen is displayed. | 575 // TODO(dpolukhin): show error message after login screen is displayed. |
556 ShowLoginScreen(LoginScreenContext()); | 576 ShowLoginScreen(LoginScreenContext()); |
557 } | 577 } |
558 | 578 |
559 void WizardController::OnUpdateCompleted() { | 579 void WizardController::OnUpdateCompleted() { |
560 StartAutoEnrollmentCheck(); | 580 ShowAutoEnrollmentCheckScreen(); |
561 } | 581 } |
562 | 582 |
563 void WizardController::OnEulaAccepted() { | 583 void WizardController::OnEulaAccepted() { |
564 time_eula_accepted_ = base::Time::Now(); | 584 time_eula_accepted_ = base::Time::Now(); |
565 StartupUtils::MarkEulaAccepted(); | 585 StartupUtils::MarkEulaAccepted(); |
566 bool uma_enabled = | 586 bool uma_enabled = |
567 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); | 587 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); |
568 | 588 |
569 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); | 589 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); |
570 if (uma_enabled) { | 590 if (uma_enabled) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 else | 690 else |
671 ShowLoginScreen(LoginScreenContext()); | 691 ShowLoginScreen(LoginScreenContext()); |
672 } | 692 } |
673 | 693 |
674 void WizardController::OnAutoEnrollmentDone() { | 694 void WizardController::OnAutoEnrollmentDone() { |
675 VLOG(1) << "Automagic enrollment done, resuming previous signin"; | 695 VLOG(1) << "Automagic enrollment done, resuming previous signin"; |
676 ResumeLoginScreen(); | 696 ResumeLoginScreen(); |
677 } | 697 } |
678 | 698 |
679 void WizardController::OnOOBECompleted() { | 699 void WizardController::OnOOBECompleted() { |
680 auto_enrollment_check_step_.reset(); | |
681 if (ShouldAutoStartEnrollment()) { | 700 if (ShouldAutoStartEnrollment()) { |
682 ShowEnrollmentScreen(); | 701 ShowEnrollmentScreen(); |
683 } else { | 702 } else { |
684 PerformOOBECompletedActions(); | 703 PerformOOBECompletedActions(); |
685 ShowLoginScreen(LoginScreenContext()); | 704 ShowLoginScreen(LoginScreenContext()); |
686 } | 705 } |
687 } | 706 } |
688 | 707 |
689 void WizardController::OnTermsOfServiceDeclined() { | 708 void WizardController::OnTermsOfServiceDeclined() { |
690 // If the user declines the Terms of Service, end the session and return to | 709 // If the user declines the Terms of Service, end the session and return to |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 } else if (screen_name == kKioskEnableScreenName) { | 823 } else if (screen_name == kKioskEnableScreenName) { |
805 ShowKioskEnableScreen(); | 824 ShowKioskEnableScreen(); |
806 } else if (screen_name == kKioskAutolaunchScreenName) { | 825 } else if (screen_name == kKioskAutolaunchScreenName) { |
807 ShowKioskAutolaunchScreen(); | 826 ShowKioskAutolaunchScreen(); |
808 } else if (screen_name == kEnrollmentScreenName) { | 827 } else if (screen_name == kEnrollmentScreenName) { |
809 ShowEnrollmentScreen(); | 828 ShowEnrollmentScreen(); |
810 } else if (screen_name == kTermsOfServiceScreenName) { | 829 } else if (screen_name == kTermsOfServiceScreenName) { |
811 ShowTermsOfServiceScreen(); | 830 ShowTermsOfServiceScreen(); |
812 } else if (screen_name == kWrongHWIDScreenName) { | 831 } else if (screen_name == kWrongHWIDScreenName) { |
813 ShowWrongHWIDScreen(); | 832 ShowWrongHWIDScreen(); |
| 833 } else if (screen_name == kAutoEnrollmentCheckScreenName) { |
| 834 ShowAutoEnrollmentCheckScreen(); |
814 } else if (screen_name == kLocallyManagedUserCreationScreenName) { | 835 } else if (screen_name == kLocallyManagedUserCreationScreenName) { |
815 ShowLocallyManagedUserCreationScreen(); | 836 ShowLocallyManagedUserCreationScreen(); |
816 } else if (screen_name == kAppLaunchSplashScreenName) { | 837 } else if (screen_name == kAppLaunchSplashScreenName) { |
817 AutoLaunchKioskApp(); | 838 AutoLaunchKioskApp(); |
818 } else if (screen_name == kHIDDetectionScreenName) { | 839 } else if (screen_name == kHIDDetectionScreenName) { |
819 ShowHIDDetectionScreen(); | 840 ShowHIDDetectionScreen(); |
820 } else if (screen_name != kTestNoScreenName) { | 841 } else if (screen_name != kTestNoScreenName) { |
821 if (is_out_of_box_) { | 842 if (is_out_of_box_) { |
822 if (CanShowHIDDetectionScreen()) | 843 if (CanShowHIDDetectionScreen()) |
823 ShowHIDDetectionScreen(); | 844 ShowHIDDetectionScreen(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 void WizardController::OnLocalStateInitialized(bool /* succeeded */) { | 1021 void WizardController::OnLocalStateInitialized(bool /* succeeded */) { |
1001 if (GetLocalState()->GetInitializationStatus() != | 1022 if (GetLocalState()->GetInitializationStatus() != |
1002 PrefService::INITIALIZATION_STATUS_ERROR) { | 1023 PrefService::INITIALIZATION_STATUS_ERROR) { |
1003 return; | 1024 return; |
1004 } | 1025 } |
1005 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_LOCAL_STATE_ERROR); | 1026 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_LOCAL_STATE_ERROR); |
1006 SetStatusAreaVisible(false); | 1027 SetStatusAreaVisible(false); |
1007 ShowErrorScreen(); | 1028 ShowErrorScreen(); |
1008 } | 1029 } |
1009 | 1030 |
1010 void WizardController::StartAutoEnrollmentCheck() { | |
1011 auto_enrollment_check_step_.reset( | |
1012 new AutoEnrollmentCheckStep(this, host_->GetAutoEnrollmentController())); | |
1013 auto_enrollment_check_step_->Start(); | |
1014 } | |
1015 | |
1016 PrefService* WizardController::GetLocalState() { | 1031 PrefService* WizardController::GetLocalState() { |
1017 if (local_state_for_testing_) | 1032 if (local_state_for_testing_) |
1018 return local_state_for_testing_; | 1033 return local_state_for_testing_; |
1019 return g_browser_process->local_state(); | 1034 return g_browser_process->local_state(); |
1020 } | 1035 } |
1021 | 1036 |
1022 void WizardController::OnTimezoneResolved( | 1037 void WizardController::OnTimezoneResolved( |
1023 scoped_ptr<TimeZoneResponseData> timezone, | 1038 scoped_ptr<TimeZoneResponseData> timezone, |
1024 bool server_error) { | 1039 bool server_error) { |
1025 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1040 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 // cancelled on destruction. | 1103 // cancelled on destruction. |
1089 GetTimezoneProvider()->RequestTimezone( | 1104 GetTimezoneProvider()->RequestTimezone( |
1090 position, | 1105 position, |
1091 false, // sensor | 1106 false, // sensor |
1092 timeout - elapsed, | 1107 timeout - elapsed, |
1093 base::Bind(&WizardController::OnTimezoneResolved, | 1108 base::Bind(&WizardController::OnTimezoneResolved, |
1094 base::Unretained(this))); | 1109 base::Unretained(this))); |
1095 } | 1110 } |
1096 | 1111 |
1097 } // namespace chromeos | 1112 } // namespace chromeos |
OLD | NEW |