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_display_host.h" | 33 #include "chrome/browser/chromeos/login/login_display_host.h" |
34 #include "chrome/browser/chromeos/login/login_utils.h" | 34 #include "chrome/browser/chromeos/login/login_utils.h" |
35 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc reen.h" | 35 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc reen.h" |
36 #include "chrome/browser/chromeos/login/oobe_display.h" | 36 #include "chrome/browser/chromeos/login/oobe_display.h" |
37 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 37 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
38 #include "chrome/browser/chromeos/login/screens/eula_screen.h" | 38 #include "chrome/browser/chromeos/login/screens/eula_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); | |
Mattias Nissler (ping if slow)
2014/05/19 19:25:51
Why? I think the status area is supposed to be hid
pastarmovj
2014/05/20 13:50:08
All other OOBE screens are like that - see ShowEul
| |
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 } else if (screen_name == kKioskEnableScreenName) { | 827 } else if (screen_name == kKioskEnableScreenName) { |
809 ShowKioskEnableScreen(); | 828 ShowKioskEnableScreen(); |
810 } else if (screen_name == kKioskAutolaunchScreenName) { | 829 } else if (screen_name == kKioskAutolaunchScreenName) { |
811 ShowKioskAutolaunchScreen(); | 830 ShowKioskAutolaunchScreen(); |
812 } else if (screen_name == kEnrollmentScreenName) { | 831 } else if (screen_name == kEnrollmentScreenName) { |
813 ShowEnrollmentScreen(); | 832 ShowEnrollmentScreen(); |
814 } else if (screen_name == kTermsOfServiceScreenName) { | 833 } else if (screen_name == kTermsOfServiceScreenName) { |
815 ShowTermsOfServiceScreen(); | 834 ShowTermsOfServiceScreen(); |
816 } else if (screen_name == kWrongHWIDScreenName) { | 835 } else if (screen_name == kWrongHWIDScreenName) { |
817 ShowWrongHWIDScreen(); | 836 ShowWrongHWIDScreen(); |
837 } else if (screen_name == kAutoEnrollmentCheckScreenName) { | |
838 ShowAutoEnrollmentCheckScreen(); | |
818 } else if (screen_name == kLocallyManagedUserCreationScreenName) { | 839 } else if (screen_name == kLocallyManagedUserCreationScreenName) { |
819 ShowLocallyManagedUserCreationScreen(); | 840 ShowLocallyManagedUserCreationScreen(); |
820 } else if (screen_name == kAppLaunchSplashScreenName) { | 841 } else if (screen_name == kAppLaunchSplashScreenName) { |
821 AutoLaunchKioskApp(); | 842 AutoLaunchKioskApp(); |
822 } else if (screen_name == kHIDDetectionScreenName) { | 843 } else if (screen_name == kHIDDetectionScreenName) { |
823 ShowHIDDetectionScreen(); | 844 ShowHIDDetectionScreen(); |
824 } else if (screen_name != kTestNoScreenName) { | 845 } else if (screen_name != kTestNoScreenName) { |
825 if (is_out_of_box_) { | 846 if (is_out_of_box_) { |
826 if (CanShowHIDDetectionScreen()) | 847 if (CanShowHIDDetectionScreen()) |
827 ShowHIDDetectionScreen(); | 848 ShowHIDDetectionScreen(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1004 void WizardController::OnLocalStateInitialized(bool /* succeeded */) { | 1025 void WizardController::OnLocalStateInitialized(bool /* succeeded */) { |
1005 if (GetLocalState()->GetInitializationStatus() != | 1026 if (GetLocalState()->GetInitializationStatus() != |
1006 PrefService::INITIALIZATION_STATUS_ERROR) { | 1027 PrefService::INITIALIZATION_STATUS_ERROR) { |
1007 return; | 1028 return; |
1008 } | 1029 } |
1009 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_LOCAL_STATE_ERROR); | 1030 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_LOCAL_STATE_ERROR); |
1010 SetStatusAreaVisible(false); | 1031 SetStatusAreaVisible(false); |
1011 ShowErrorScreen(); | 1032 ShowErrorScreen(); |
1012 } | 1033 } |
1013 | 1034 |
1014 void WizardController::StartAutoEnrollmentCheck() { | |
1015 auto_enrollment_check_step_.reset( | |
1016 new AutoEnrollmentCheckStep(this, host_->GetAutoEnrollmentController())); | |
1017 auto_enrollment_check_step_->Start(); | |
1018 } | |
1019 | |
1020 PrefService* WizardController::GetLocalState() { | 1035 PrefService* WizardController::GetLocalState() { |
1021 if (local_state_for_testing_) | 1036 if (local_state_for_testing_) |
1022 return local_state_for_testing_; | 1037 return local_state_for_testing_; |
1023 return g_browser_process->local_state(); | 1038 return g_browser_process->local_state(); |
1024 } | 1039 } |
1025 | 1040 |
1026 void WizardController::OnTimezoneResolved( | 1041 void WizardController::OnTimezoneResolved( |
1027 scoped_ptr<TimeZoneResponseData> timezone, | 1042 scoped_ptr<TimeZoneResponseData> timezone, |
1028 bool server_error) { | 1043 bool server_error) { |
1029 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1044 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1092 // cancelled on destruction. | 1107 // cancelled on destruction. |
1093 GetTimezoneProvider()->RequestTimezone( | 1108 GetTimezoneProvider()->RequestTimezone( |
1094 position, | 1109 position, |
1095 false, // sensor | 1110 false, // sensor |
1096 timeout - elapsed, | 1111 timeout - elapsed, |
1097 base::Bind(&WizardController::OnTimezoneResolved, | 1112 base::Bind(&WizardController::OnTimezoneResolved, |
1098 base::Unretained(this))); | 1113 base::Unretained(this))); |
1099 } | 1114 } |
1100 | 1115 |
1101 } // namespace chromeos | 1116 } // namespace chromeos |
OLD | NEW |