| 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 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 26 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 27 #include "chrome/browser/chromeos/customization_document.h" | 27 #include "chrome/browser/chromeos/customization_document.h" |
| 28 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" | 28 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" |
| 29 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.
h" | 29 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.
h" |
| 30 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" | 30 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" |
| 31 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 31 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 32 #include "chrome/browser/chromeos/login/helper.h" | 32 #include "chrome/browser/chromeos/login/helper.h" |
| 33 #include "chrome/browser/chromeos/login/hwid_checker.h" | 33 #include "chrome/browser/chromeos/login/hwid_checker.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/screens/controller_pairing_screen.h" |
| 36 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 37 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
| 37 #include "chrome/browser/chromeos/login/screens/eula_screen.h" | 38 #include "chrome/browser/chromeos/login/screens/eula_screen.h" |
| 38 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" | 39 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" |
| 39 #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h" | 40 #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h" |
| 40 #include "chrome/browser/chromeos/login/screens/kiosk_enable_screen.h" | 41 #include "chrome/browser/chromeos/login/screens/kiosk_enable_screen.h" |
| 41 #include "chrome/browser/chromeos/login/screens/network_screen.h" | 42 #include "chrome/browser/chromeos/login/screens/network_screen.h" |
| 42 #include "chrome/browser/chromeos/login/screens/reset_screen.h" | 43 #include "chrome/browser/chromeos/login/screens/reset_screen.h" |
| 43 #include "chrome/browser/chromeos/login/screens/terms_of_service_screen.h" | 44 #include "chrome/browser/chromeos/login/screens/terms_of_service_screen.h" |
| 44 #include "chrome/browser/chromeos/login/screens/update_screen.h" | 45 #include "chrome/browser/chromeos/login/screens/update_screen.h" |
| 45 #include "chrome/browser/chromeos/login/screens/user_image_screen.h" | 46 #include "chrome/browser/chromeos/login/screens/user_image_screen.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 chromeos::WizardController::kEnrollmentScreenName, | 96 chromeos::WizardController::kEnrollmentScreenName, |
| 96 chromeos::WizardController::kTermsOfServiceScreenName | 97 chromeos::WizardController::kTermsOfServiceScreenName |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 // Checks flag for HID-detection screen show. | 100 // Checks flag for HID-detection screen show. |
| 100 bool CanShowHIDDetectionScreen() { | 101 bool CanShowHIDDetectionScreen() { |
| 101 return CommandLine::ForCurrentProcess()->HasSwitch( | 102 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 102 chromeos::switches::kEnableHIDDetectionOnOOBE); | 103 chromeos::switches::kEnableHIDDetectionOnOOBE); |
| 103 } | 104 } |
| 104 | 105 |
| 106 bool ShouldShowControllerPairingScreen() { |
| 107 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 108 chromeos::switches::kShowControllerPairingDemo); |
| 109 } |
| 110 |
| 105 bool IsResumableScreen(const std::string& screen) { | 111 bool IsResumableScreen(const std::string& screen) { |
| 106 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kResumableScreens); ++i) { | 112 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kResumableScreens); ++i) { |
| 107 if (screen == kResumableScreens[i]) | 113 if (screen == kResumableScreens[i]) |
| 108 return true; | 114 return true; |
| 109 } | 115 } |
| 110 return false; | 116 return false; |
| 111 } | 117 } |
| 112 | 118 |
| 113 } // namespace | 119 } // namespace |
| 114 | 120 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 126 const char WizardController::kErrorScreenName[] = "error-message"; | 132 const char WizardController::kErrorScreenName[] = "error-message"; |
| 127 const char WizardController::kTermsOfServiceScreenName[] = "tos"; | 133 const char WizardController::kTermsOfServiceScreenName[] = "tos"; |
| 128 const char WizardController::kAutoEnrollmentCheckScreenName[] = | 134 const char WizardController::kAutoEnrollmentCheckScreenName[] = |
| 129 "auto-enrollment-check"; | 135 "auto-enrollment-check"; |
| 130 const char WizardController::kWrongHWIDScreenName[] = "wrong-hwid"; | 136 const char WizardController::kWrongHWIDScreenName[] = "wrong-hwid"; |
| 131 const char WizardController::kLocallyManagedUserCreationScreenName[] = | 137 const char WizardController::kLocallyManagedUserCreationScreenName[] = |
| 132 "locally-managed-user-creation-flow"; | 138 "locally-managed-user-creation-flow"; |
| 133 const char WizardController::kAppLaunchSplashScreenName[] = | 139 const char WizardController::kAppLaunchSplashScreenName[] = |
| 134 "app-launch-splash"; | 140 "app-launch-splash"; |
| 135 const char WizardController::kHIDDetectionScreenName[] = "hid-detection"; | 141 const char WizardController::kHIDDetectionScreenName[] = "hid-detection"; |
| 142 const char WizardController::kControllerPairingScreenName[] = |
| 143 "controller-pairing"; |
| 136 | 144 |
| 137 // static | 145 // static |
| 138 const int WizardController::kMinAudibleOutputVolumePercent = 10; | 146 const int WizardController::kMinAudibleOutputVolumePercent = 10; |
| 139 | 147 |
| 140 // Passing this parameter as a "first screen" initiates full OOBE flow. | 148 // Passing this parameter as a "first screen" initiates full OOBE flow. |
| 141 const char WizardController::kOutOfBoxScreenName[] = "oobe"; | 149 const char WizardController::kOutOfBoxScreenName[] = "oobe"; |
| 142 | 150 |
| 143 // Special test value that commands not to create any window yet. | 151 // Special test value that commands not to create any window yet. |
| 144 const char WizardController::kTestNoScreenName[] = "test:nowindow"; | 152 const char WizardController::kTestNoScreenName[] = "test:nowindow"; |
| 145 | 153 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 359 |
| 352 chromeos::HIDDetectionScreen* WizardController::GetHIDDetectionScreen() { | 360 chromeos::HIDDetectionScreen* WizardController::GetHIDDetectionScreen() { |
| 353 if (!hid_detection_screen_.get()) { | 361 if (!hid_detection_screen_.get()) { |
| 354 hid_detection_screen_.reset( | 362 hid_detection_screen_.reset( |
| 355 new chromeos::HIDDetectionScreen( | 363 new chromeos::HIDDetectionScreen( |
| 356 this, oobe_display_->GetHIDDetectionScreenActor())); | 364 this, oobe_display_->GetHIDDetectionScreenActor())); |
| 357 } | 365 } |
| 358 return hid_detection_screen_.get(); | 366 return hid_detection_screen_.get(); |
| 359 } | 367 } |
| 360 | 368 |
| 369 ControllerPairingScreen* WizardController::GetControllerPairingScreen() { |
| 370 if (!controller_pairing_screen_) { |
| 371 controller_pairing_screen_.reset(new ControllerPairingScreen( |
| 372 this, oobe_display_->GetControllerPairingScreenActor())); |
| 373 } |
| 374 return controller_pairing_screen_.get(); |
| 375 } |
| 376 |
| 361 void WizardController::ShowNetworkScreen() { | 377 void WizardController::ShowNetworkScreen() { |
| 362 VLOG(1) << "Showing network screen."; | 378 VLOG(1) << "Showing network screen."; |
| 363 // Hide the status area initially; it only appears after OOBE first animates | 379 // Hide the status area initially; it only appears after OOBE first animates |
| 364 // in. Keep it visible if the user goes back to the existing network screen. | 380 // in. Keep it visible if the user goes back to the existing network screen. |
| 365 SetStatusAreaVisible(network_screen_.get()); | 381 SetStatusAreaVisible(network_screen_.get()); |
| 366 SetCurrentScreen(GetNetworkScreen()); | 382 SetCurrentScreen(GetNetworkScreen()); |
| 367 } | 383 } |
| 368 | 384 |
| 369 void WizardController::ShowLoginScreen(const LoginScreenContext& context) { | 385 void WizardController::ShowLoginScreen(const LoginScreenContext& context) { |
| 370 if (!time_eula_accepted_.is_null()) { | 386 if (!time_eula_accepted_.is_null()) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 GetLocallyManagedUserCreationScreen(); | 525 GetLocallyManagedUserCreationScreen(); |
| 510 SetCurrentScreen(screen); | 526 SetCurrentScreen(screen); |
| 511 } | 527 } |
| 512 | 528 |
| 513 void WizardController::ShowHIDDetectionScreen() { | 529 void WizardController::ShowHIDDetectionScreen() { |
| 514 VLOG(1) << "Showing HID discovery screen."; | 530 VLOG(1) << "Showing HID discovery screen."; |
| 515 SetStatusAreaVisible(true); | 531 SetStatusAreaVisible(true); |
| 516 SetCurrentScreen(GetHIDDetectionScreen()); | 532 SetCurrentScreen(GetHIDDetectionScreen()); |
| 517 } | 533 } |
| 518 | 534 |
| 535 void WizardController::ShowControllerPairingScreen() { |
| 536 VLOG(1) << "Showing controller pairing screen."; |
| 537 SetStatusAreaVisible(false); |
| 538 SetCurrentScreen(GetControllerPairingScreen()); |
| 539 } |
| 540 |
| 519 void WizardController::SkipToLoginForTesting( | 541 void WizardController::SkipToLoginForTesting( |
| 520 const LoginScreenContext& context) { | 542 const LoginScreenContext& context) { |
| 521 VLOG(1) << "SkipToLoginForTesting."; | 543 VLOG(1) << "SkipToLoginForTesting."; |
| 522 StartupUtils::MarkEulaAccepted(); | 544 StartupUtils::MarkEulaAccepted(); |
| 523 PerformPostEulaActions(); | 545 PerformPostEulaActions(); |
| 524 OnOOBECompleted(); | 546 OnOOBECompleted(); |
| 525 } | 547 } |
| 526 | 548 |
| 527 void WizardController::AddObserver(Observer* observer) { | 549 void WizardController::AddObserver(Observer* observer) { |
| 528 observer_list_.AddObserver(observer); | 550 observer_list_.AddObserver(observer); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 // should report some error message here and stay on the same screen. | 585 // should report some error message here and stay on the same screen. |
| 564 ShowLoginScreen(LoginScreenContext()); | 586 ShowLoginScreen(LoginScreenContext()); |
| 565 } | 587 } |
| 566 | 588 |
| 567 void WizardController::OnConnectionFailed() { | 589 void WizardController::OnConnectionFailed() { |
| 568 // TODO(dpolukhin): show error message after login screen is displayed. | 590 // TODO(dpolukhin): show error message after login screen is displayed. |
| 569 ShowLoginScreen(LoginScreenContext()); | 591 ShowLoginScreen(LoginScreenContext()); |
| 570 } | 592 } |
| 571 | 593 |
| 572 void WizardController::OnUpdateCompleted() { | 594 void WizardController::OnUpdateCompleted() { |
| 573 ShowAutoEnrollmentCheckScreen(); | 595 if (ShouldShowControllerPairingScreen()) { |
| 596 ShowControllerPairingScreen(); |
| 597 } else { |
| 598 ShowAutoEnrollmentCheckScreen(); |
| 599 } |
| 574 } | 600 } |
| 575 | 601 |
| 576 void WizardController::OnEulaAccepted() { | 602 void WizardController::OnEulaAccepted() { |
| 577 time_eula_accepted_ = base::Time::Now(); | 603 time_eula_accepted_ = base::Time::Now(); |
| 578 StartupUtils::MarkEulaAccepted(); | 604 StartupUtils::MarkEulaAccepted(); |
| 579 bool uma_enabled = | 605 bool uma_enabled = |
| 580 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); | 606 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); |
| 581 | 607 |
| 582 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); | 608 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); |
| 583 if (uma_enabled) { | 609 if (uma_enabled) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 // If the user declines the Terms of Service, end the session and return to | 722 // If the user declines the Terms of Service, end the session and return to |
| 697 // the login screen. | 723 // the login screen. |
| 698 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); | 724 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); |
| 699 } | 725 } |
| 700 | 726 |
| 701 void WizardController::OnTermsOfServiceAccepted() { | 727 void WizardController::OnTermsOfServiceAccepted() { |
| 702 // If the user accepts the Terms of Service, advance to the user image screen. | 728 // If the user accepts the Terms of Service, advance to the user image screen. |
| 703 ShowUserImageScreen(); | 729 ShowUserImageScreen(); |
| 704 } | 730 } |
| 705 | 731 |
| 732 void WizardController::OnControllerPairingFinished() { |
| 733 ShowAutoEnrollmentCheckScreen(); |
| 734 } |
| 735 |
| 706 void WizardController::InitiateOOBEUpdate() { | 736 void WizardController::InitiateOOBEUpdate() { |
| 707 PerformPostEulaActions(); | 737 PerformPostEulaActions(); |
| 708 SetCurrentScreenSmooth(GetUpdateScreen(), true); | 738 SetCurrentScreenSmooth(GetUpdateScreen(), true); |
| 709 GetUpdateScreen()->StartNetworkCheck(); | 739 GetUpdateScreen()->StartNetworkCheck(); |
| 710 } | 740 } |
| 711 | 741 |
| 712 void WizardController::StartTimezoneResolve() { | 742 void WizardController::StartTimezoneResolve() { |
| 713 geolocation_provider_.reset(new SimpleGeolocationProvider( | 743 geolocation_provider_.reset(new SimpleGeolocationProvider( |
| 714 g_browser_process->system_request_context(), | 744 g_browser_process->system_request_context(), |
| 715 SimpleGeolocationProvider::DefaultGeolocationProviderURL())); | 745 SimpleGeolocationProvider::DefaultGeolocationProviderURL())); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 return; | 787 return; |
| 758 | 788 |
| 759 // First remember how far have we reached so that we can resume if needed. | 789 // First remember how far have we reached so that we can resume if needed. |
| 760 if (is_out_of_box_ && IsResumableScreen(current_screen_->GetName())) | 790 if (is_out_of_box_ && IsResumableScreen(current_screen_->GetName())) |
| 761 StartupUtils::SaveOobePendingScreen(current_screen_->GetName()); | 791 StartupUtils::SaveOobePendingScreen(current_screen_->GetName()); |
| 762 | 792 |
| 763 smooth_show_timer_.Stop(); | 793 smooth_show_timer_.Stop(); |
| 764 | 794 |
| 765 FOR_EACH_OBSERVER(Observer, observer_list_, OnScreenChanged(current_screen_)); | 795 FOR_EACH_OBSERVER(Observer, observer_list_, OnScreenChanged(current_screen_)); |
| 766 | 796 |
| 767 oobe_display_->ShowScreen(current_screen_); | 797 current_screen_->Show(); |
| 768 } | 798 } |
| 769 | 799 |
| 770 void WizardController::SetCurrentScreenSmooth(WizardScreen* new_current, | 800 void WizardController::SetCurrentScreenSmooth(WizardScreen* new_current, |
| 771 bool use_smoothing) { | 801 bool use_smoothing) { |
| 772 if (current_screen_ == new_current || | 802 if (current_screen_ == new_current || |
| 773 new_current == NULL || | 803 new_current == NULL || |
| 774 oobe_display_ == NULL) { | 804 oobe_display_ == NULL) { |
| 775 return; | 805 return; |
| 776 } | 806 } |
| 777 | 807 |
| 778 smooth_show_timer_.Stop(); | 808 smooth_show_timer_.Stop(); |
| 779 | 809 |
| 780 if (current_screen_) | 810 if (current_screen_) |
| 781 oobe_display_->HideScreen(current_screen_); | 811 current_screen_->Hide(); |
| 782 | 812 |
| 783 previous_screen_ = current_screen_; | 813 previous_screen_ = current_screen_; |
| 784 current_screen_ = new_current; | 814 current_screen_ = new_current; |
| 785 | 815 |
| 786 if (use_smoothing) { | 816 if (use_smoothing) { |
| 787 smooth_show_timer_.Start( | 817 smooth_show_timer_.Start( |
| 788 FROM_HERE, | 818 FROM_HERE, |
| 789 base::TimeDelta::FromMilliseconds(kShowDelayMs), | 819 base::TimeDelta::FromMilliseconds(kShowDelayMs), |
| 790 this, | 820 this, |
| 791 &WizardController::ShowCurrentScreen); | 821 &WizardController::ShowCurrentScreen); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 822 } else if (screen_name == kWrongHWIDScreenName) { | 852 } else if (screen_name == kWrongHWIDScreenName) { |
| 823 ShowWrongHWIDScreen(); | 853 ShowWrongHWIDScreen(); |
| 824 } else if (screen_name == kAutoEnrollmentCheckScreenName) { | 854 } else if (screen_name == kAutoEnrollmentCheckScreenName) { |
| 825 ShowAutoEnrollmentCheckScreen(); | 855 ShowAutoEnrollmentCheckScreen(); |
| 826 } else if (screen_name == kLocallyManagedUserCreationScreenName) { | 856 } else if (screen_name == kLocallyManagedUserCreationScreenName) { |
| 827 ShowLocallyManagedUserCreationScreen(); | 857 ShowLocallyManagedUserCreationScreen(); |
| 828 } else if (screen_name == kAppLaunchSplashScreenName) { | 858 } else if (screen_name == kAppLaunchSplashScreenName) { |
| 829 AutoLaunchKioskApp(); | 859 AutoLaunchKioskApp(); |
| 830 } else if (screen_name == kHIDDetectionScreenName) { | 860 } else if (screen_name == kHIDDetectionScreenName) { |
| 831 ShowHIDDetectionScreen(); | 861 ShowHIDDetectionScreen(); |
| 862 } else if (screen_name == kControllerPairingScreenName) { |
| 863 ShowControllerPairingScreen(); |
| 832 } else if (screen_name != kTestNoScreenName) { | 864 } else if (screen_name != kTestNoScreenName) { |
| 833 if (is_out_of_box_) { | 865 if (is_out_of_box_) { |
| 834 if (CanShowHIDDetectionScreen()) | 866 if (CanShowHIDDetectionScreen()) |
| 835 ShowHIDDetectionScreen(); | 867 ShowHIDDetectionScreen(); |
| 836 else | 868 else |
| 837 ShowNetworkScreen(); | 869 ShowNetworkScreen(); |
| 838 } else { | 870 } else { |
| 839 ShowLoginScreen(LoginScreenContext()); | 871 ShowLoginScreen(LoginScreenContext()); |
| 840 } | 872 } |
| 841 } | 873 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 break; | 932 break; |
| 901 case TERMS_OF_SERVICE_DECLINED: | 933 case TERMS_OF_SERVICE_DECLINED: |
| 902 OnTermsOfServiceDeclined(); | 934 OnTermsOfServiceDeclined(); |
| 903 break; | 935 break; |
| 904 case TERMS_OF_SERVICE_ACCEPTED: | 936 case TERMS_OF_SERVICE_ACCEPTED: |
| 905 OnTermsOfServiceAccepted(); | 937 OnTermsOfServiceAccepted(); |
| 906 break; | 938 break; |
| 907 case WRONG_HWID_WARNING_SKIPPED: | 939 case WRONG_HWID_WARNING_SKIPPED: |
| 908 OnWrongHWIDWarningSkipped(); | 940 OnWrongHWIDWarningSkipped(); |
| 909 break; | 941 break; |
| 942 case CONTROLLER_PAIRING_FINISHED: |
| 943 OnControllerPairingFinished(); |
| 944 break; |
| 910 default: | 945 default: |
| 911 NOTREACHED(); | 946 NOTREACHED(); |
| 912 } | 947 } |
| 913 } | 948 } |
| 914 | 949 |
| 915 void WizardController::OnSetUserNamePassword(const std::string& username, | 950 void WizardController::OnSetUserNamePassword(const std::string& username, |
| 916 const std::string& password) { | 951 const std::string& password) { |
| 917 username_ = username; | 952 username_ = username; |
| 918 password_ = password; | 953 password_ = password; |
| 919 } | 954 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 bool WizardController::SetOnTimeZoneResolvedForTesting( | 1142 bool WizardController::SetOnTimeZoneResolvedForTesting( |
| 1108 const base::Closure& callback) { | 1143 const base::Closure& callback) { |
| 1109 if (timezone_resolved_) | 1144 if (timezone_resolved_) |
| 1110 return false; | 1145 return false; |
| 1111 | 1146 |
| 1112 on_timezone_resolved_for_testing_ = callback; | 1147 on_timezone_resolved_for_testing_ = callback; |
| 1113 return true; | 1148 return true; |
| 1114 } | 1149 } |
| 1115 | 1150 |
| 1116 } // namespace chromeos | 1151 } // namespace chromeos |
| OLD | NEW |