| 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/callback_helpers.h" | 15 #include "base/callback_helpers.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/prefs/pref_registry_simple.h" | 18 #include "base/prefs/pref_registry_simple.h" |
| 19 #include "base/prefs/pref_service.h" | 19 #include "base/prefs/pref_service.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/threading/thread_restrictions.h" | 21 #include "base/threading/thread_restrictions.h" |
| 22 #include "base/values.h" | 22 #include "base/values.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/browser_process_platform_part.h" |
| 24 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 25 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 26 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 26 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 27 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 27 #include "chrome/browser/chromeos/customization_document.h" | 28 #include "chrome/browser/chromeos/customization_document.h" |
| 28 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" | 29 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" |
| 29 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.
h" | 30 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.
h" |
| 30 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" | 31 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" |
| 31 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 32 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 32 #include "chrome/browser/chromeos/login/helper.h" | 33 #include "chrome/browser/chromeos/login/helper.h" |
| 33 #include "chrome/browser/chromeos/login/hwid_checker.h" | 34 #include "chrome/browser/chromeos/login/hwid_checker.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 46 #include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h" | 47 #include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h" |
| 47 #include "chrome/browser/chromeos/login/startup_utils.h" | 48 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 48 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_scre
en.h" | 49 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_scre
en.h" |
| 49 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 50 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 50 #include "chrome/browser/chromeos/login/ui/oobe_display.h" | 51 #include "chrome/browser/chromeos/login/ui/oobe_display.h" |
| 51 #include "chrome/browser/chromeos/net/delay_network_call.h" | 52 #include "chrome/browser/chromeos/net/delay_network_call.h" |
| 52 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 53 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 53 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" | 54 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" |
| 54 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 55 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 55 #include "chrome/browser/chromeos/settings/cros_settings.h" | 56 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 57 #include "chrome/browser/chromeos/system/device_disabling_manager.h" |
| 56 #include "chrome/browser/chromeos/timezone/timezone_provider.h" | 58 #include "chrome/browser/chromeos/timezone/timezone_provider.h" |
| 57 #include "chrome/browser/lifetime/application_lifetime.h" | 59 #include "chrome/browser/lifetime/application_lifetime.h" |
| 58 #include "chrome/browser/metrics/metrics_reporting_state.h" | 60 #include "chrome/browser/metrics/metrics_reporting_state.h" |
| 59 #include "chrome/browser/profiles/profile.h" | 61 #include "chrome/browser/profiles/profile.h" |
| 60 #include "chrome/browser/profiles/profile_manager.h" | 62 #include "chrome/browser/profiles/profile_manager.h" |
| 61 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 63 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 62 #include "chrome/common/chrome_constants.h" | 64 #include "chrome/common/chrome_constants.h" |
| 63 #include "chrome/common/pref_names.h" | 65 #include "chrome/common/pref_names.h" |
| 64 #include "chromeos/audio/cras_audio_handler.h" | 66 #include "chromeos/audio/cras_audio_handler.h" |
| 65 #include "chromeos/chromeos_constants.h" | 67 #include "chromeos/chromeos_constants.h" |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 VLOG(1) << "Showing device disabled screen."; | 538 VLOG(1) << "Showing device disabled screen."; |
| 537 SetStatusAreaVisible(true); | 539 SetStatusAreaVisible(true); |
| 538 SetCurrentScreen(GetScreen(kDeviceDisabledScreenName)); | 540 SetCurrentScreen(GetScreen(kDeviceDisabledScreenName)); |
| 539 } | 541 } |
| 540 | 542 |
| 541 void WizardController::SkipToLoginForTesting( | 543 void WizardController::SkipToLoginForTesting( |
| 542 const LoginScreenContext& context) { | 544 const LoginScreenContext& context) { |
| 543 VLOG(1) << "SkipToLoginForTesting."; | 545 VLOG(1) << "SkipToLoginForTesting."; |
| 544 StartupUtils::MarkEulaAccepted(); | 546 StartupUtils::MarkEulaAccepted(); |
| 545 PerformPostEulaActions(); | 547 PerformPostEulaActions(); |
| 546 OnDeviceNotDisabled(); | 548 OnDeviceDisabledChecked(false /* device_disabled */); |
| 547 } | 549 } |
| 548 | 550 |
| 549 void WizardController::AddObserver(Observer* observer) { | 551 void WizardController::AddObserver(Observer* observer) { |
| 550 observer_list_.AddObserver(observer); | 552 observer_list_.AddObserver(observer); |
| 551 } | 553 } |
| 552 | 554 |
| 553 void WizardController::RemoveObserver(Observer* observer) { | 555 void WizardController::RemoveObserver(Observer* observer) { |
| 554 observer_list_.RemoveObserver(observer); | 556 observer_list_.RemoveObserver(observer); |
| 555 } | 557 } |
| 556 | 558 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 } | 754 } |
| 753 | 755 |
| 754 void WizardController::OnControllerPairingFinished() { | 756 void WizardController::OnControllerPairingFinished() { |
| 755 ShowAutoEnrollmentCheckScreen(); | 757 ShowAutoEnrollmentCheckScreen(); |
| 756 } | 758 } |
| 757 | 759 |
| 758 void WizardController::OnHostPairingFinished() { | 760 void WizardController::OnHostPairingFinished() { |
| 759 InitiateOOBEUpdate(); | 761 InitiateOOBEUpdate(); |
| 760 } | 762 } |
| 761 | 763 |
| 762 void WizardController::OnDeviceNotDisabled() { | 764 void WizardController::OnAutoEnrollmentCheckCompleted() { |
| 763 if (skip_update_enroll_after_eula_ || | 765 // Check whether the device is disabled. OnDeviceDisabledChecked() will be |
| 764 ShouldAutoStartEnrollment() || | 766 // invoked when the result of this check is known. Until then, the current |
| 765 enrollment_recovery_) { | 767 // screen will remain visible and will continue showing a spinner. |
| 768 g_browser_process->platform_part()->device_disabling_manager()-> |
| 769 CheckWhetherDeviceDisabledDuringOOBE(base::Bind( |
| 770 &WizardController::OnDeviceDisabledChecked, |
| 771 weak_factory_.GetWeakPtr())); |
| 772 } |
| 773 |
| 774 void WizardController::OnDeviceDisabledChecked(bool device_disabled) { |
| 775 if (device_disabled) { |
| 776 ShowDeviceDisabledScreen(); |
| 777 } else if (skip_update_enroll_after_eula_ || |
| 778 ShouldAutoStartEnrollment() || |
| 779 enrollment_recovery_) { |
| 766 ShowEnrollmentScreen(); | 780 ShowEnrollmentScreen(); |
| 767 } else { | 781 } else { |
| 768 PerformOOBECompletedActions(); | 782 PerformOOBECompletedActions(); |
| 769 ShowLoginScreen(LoginScreenContext()); | 783 ShowLoginScreen(LoginScreenContext()); |
| 770 } | 784 } |
| 771 } | 785 } |
| 772 | 786 |
| 773 void WizardController::InitiateOOBEUpdate() { | 787 void WizardController::InitiateOOBEUpdate() { |
| 774 VLOG(1) << "InitiateOOBEUpdate"; | 788 VLOG(1) << "InitiateOOBEUpdate"; |
| 775 PerformPostEulaActions(); | 789 PerformPostEulaActions(); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 case USER_IMAGE_SELECTED: | 986 case USER_IMAGE_SELECTED: |
| 973 OnUserImageSelected(); | 987 OnUserImageSelected(); |
| 974 break; | 988 break; |
| 975 case EULA_ACCEPTED: | 989 case EULA_ACCEPTED: |
| 976 OnEulaAccepted(); | 990 OnEulaAccepted(); |
| 977 break; | 991 break; |
| 978 case EULA_BACK: | 992 case EULA_BACK: |
| 979 ShowNetworkScreen(); | 993 ShowNetworkScreen(); |
| 980 break; | 994 break; |
| 981 case ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED: | 995 case ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED: |
| 982 ShowDeviceDisabledScreen(); | 996 OnAutoEnrollmentCheckCompleted(); |
| 983 break; | 997 break; |
| 984 case ENTERPRISE_ENROLLMENT_COMPLETED: | 998 case ENTERPRISE_ENROLLMENT_COMPLETED: |
| 985 OnEnrollmentDone(); | 999 OnEnrollmentDone(); |
| 986 break; | 1000 break; |
| 987 case ENTERPRISE_ENROLLMENT_BACK: | 1001 case ENTERPRISE_ENROLLMENT_BACK: |
| 988 ShowNetworkScreen(); | 1002 ShowNetworkScreen(); |
| 989 break; | 1003 break; |
| 990 case RESET_CANCELED: | 1004 case RESET_CANCELED: |
| 991 OnResetCanceled(); | 1005 OnResetCanceled(); |
| 992 break; | 1006 break; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1010 break; | 1024 break; |
| 1011 case WRONG_HWID_WARNING_SKIPPED: | 1025 case WRONG_HWID_WARNING_SKIPPED: |
| 1012 OnWrongHWIDWarningSkipped(); | 1026 OnWrongHWIDWarningSkipped(); |
| 1013 break; | 1027 break; |
| 1014 case CONTROLLER_PAIRING_FINISHED: | 1028 case CONTROLLER_PAIRING_FINISHED: |
| 1015 OnControllerPairingFinished(); | 1029 OnControllerPairingFinished(); |
| 1016 break; | 1030 break; |
| 1017 case HOST_PAIRING_FINISHED: | 1031 case HOST_PAIRING_FINISHED: |
| 1018 OnHostPairingFinished(); | 1032 OnHostPairingFinished(); |
| 1019 break; | 1033 break; |
| 1020 case DEVICE_NOT_DISABLED: | |
| 1021 OnDeviceNotDisabled(); | |
| 1022 break; | |
| 1023 default: | 1034 default: |
| 1024 NOTREACHED(); | 1035 NOTREACHED(); |
| 1025 } | 1036 } |
| 1026 } | 1037 } |
| 1027 | 1038 |
| 1028 void WizardController::ShowErrorScreen() { | 1039 void WizardController::ShowErrorScreen() { |
| 1029 VLOG(1) << "Showing error screen."; | 1040 VLOG(1) << "Showing error screen."; |
| 1030 SetCurrentScreen(GetScreen(kErrorScreenName)); | 1041 SetCurrentScreen(GetScreen(kErrorScreenName)); |
| 1031 } | 1042 } |
| 1032 | 1043 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 scoped_ptr<pairing_chromeos::HostPairingController> remora_controller) { | 1330 scoped_ptr<pairing_chromeos::HostPairingController> remora_controller) { |
| 1320 VLOG(1) << "OnSharkConnected"; | 1331 VLOG(1) << "OnSharkConnected"; |
| 1321 remora_controller_ = remora_controller.Pass(); | 1332 remora_controller_ = remora_controller.Pass(); |
| 1322 base::MessageLoop::current()->DeleteSoon( | 1333 base::MessageLoop::current()->DeleteSoon( |
| 1323 FROM_HERE, shark_connection_listener_.release()); | 1334 FROM_HERE, shark_connection_listener_.release()); |
| 1324 shark_controller_detected_ = true; | 1335 shark_controller_detected_ = true; |
| 1325 ShowHostPairingScreen(); | 1336 ShowHostPairingScreen(); |
| 1326 } | 1337 } |
| 1327 | 1338 |
| 1328 } // namespace chromeos | 1339 } // namespace chromeos |
| OLD | NEW |