| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 VLOG(1) << "Showing device disabled screen."; | 532 VLOG(1) << "Showing device disabled screen."; |
| 531 SetStatusAreaVisible(true); | 533 SetStatusAreaVisible(true); |
| 532 SetCurrentScreen(GetScreen(kDeviceDisabledScreenName)); | 534 SetCurrentScreen(GetScreen(kDeviceDisabledScreenName)); |
| 533 } | 535 } |
| 534 | 536 |
| 535 void WizardController::SkipToLoginForTesting( | 537 void WizardController::SkipToLoginForTesting( |
| 536 const LoginScreenContext& context) { | 538 const LoginScreenContext& context) { |
| 537 VLOG(1) << "SkipToLoginForTesting."; | 539 VLOG(1) << "SkipToLoginForTesting."; |
| 538 StartupUtils::MarkEulaAccepted(); | 540 StartupUtils::MarkEulaAccepted(); |
| 539 PerformPostEulaActions(); | 541 PerformPostEulaActions(); |
| 540 OnDeviceNotDisabled(); | 542 OnDeviceDisabledChecked(false /* device_disabled */); |
| 541 } | 543 } |
| 542 | 544 |
| 543 void WizardController::AddObserver(Observer* observer) { | 545 void WizardController::AddObserver(Observer* observer) { |
| 544 observer_list_.AddObserver(observer); | 546 observer_list_.AddObserver(observer); |
| 545 } | 547 } |
| 546 | 548 |
| 547 void WizardController::RemoveObserver(Observer* observer) { | 549 void WizardController::RemoveObserver(Observer* observer) { |
| 548 observer_list_.RemoveObserver(observer); | 550 observer_list_.RemoveObserver(observer); |
| 549 } | 551 } |
| 550 | 552 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 } | 748 } |
| 747 | 749 |
| 748 void WizardController::OnControllerPairingFinished() { | 750 void WizardController::OnControllerPairingFinished() { |
| 749 ShowAutoEnrollmentCheckScreen(); | 751 ShowAutoEnrollmentCheckScreen(); |
| 750 } | 752 } |
| 751 | 753 |
| 752 void WizardController::OnHostPairingFinished() { | 754 void WizardController::OnHostPairingFinished() { |
| 753 InitiateOOBEUpdate(); | 755 InitiateOOBEUpdate(); |
| 754 } | 756 } |
| 755 | 757 |
| 756 void WizardController::OnDeviceNotDisabled() { | 758 void WizardController::OnAutoEnrollmentCheckCompleted() { |
| 757 if (skip_update_enroll_after_eula_ || | 759 // Check whether the device is disabled. OnDeviceDisabledChecked() will be |
| 758 ShouldAutoStartEnrollment() || | 760 // invoked when the result of this check is known. Until then, the current |
| 759 enrollment_recovery_) { | 761 // screen will remain visible and will continue showing a spinner. |
| 762 g_browser_process->platform_part()->device_disabling_manager()-> |
| 763 CheckWhetherDeviceDisabledDuringOOBE(base::Bind( |
| 764 &WizardController::OnDeviceDisabledChecked, |
| 765 weak_factory_.GetWeakPtr())); |
| 766 } |
| 767 |
| 768 void WizardController::OnDeviceDisabledChecked(bool device_disabled) { |
| 769 if (device_disabled) { |
| 770 ShowDeviceDisabledScreen(); |
| 771 } else if (skip_update_enroll_after_eula_ || |
| 772 ShouldAutoStartEnrollment() || |
| 773 enrollment_recovery_) { |
| 760 ShowEnrollmentScreen(); | 774 ShowEnrollmentScreen(); |
| 761 } else { | 775 } else { |
| 762 PerformOOBECompletedActions(); | 776 PerformOOBECompletedActions(); |
| 763 ShowLoginScreen(LoginScreenContext()); | 777 ShowLoginScreen(LoginScreenContext()); |
| 764 } | 778 } |
| 765 } | 779 } |
| 766 | 780 |
| 767 void WizardController::InitiateOOBEUpdate() { | 781 void WizardController::InitiateOOBEUpdate() { |
| 768 VLOG(1) << "InitiateOOBEUpdate"; | 782 VLOG(1) << "InitiateOOBEUpdate"; |
| 769 PerformPostEulaActions(); | 783 PerformPostEulaActions(); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 case USER_IMAGE_SELECTED: | 980 case USER_IMAGE_SELECTED: |
| 967 OnUserImageSelected(); | 981 OnUserImageSelected(); |
| 968 break; | 982 break; |
| 969 case EULA_ACCEPTED: | 983 case EULA_ACCEPTED: |
| 970 OnEulaAccepted(); | 984 OnEulaAccepted(); |
| 971 break; | 985 break; |
| 972 case EULA_BACK: | 986 case EULA_BACK: |
| 973 ShowNetworkScreen(); | 987 ShowNetworkScreen(); |
| 974 break; | 988 break; |
| 975 case ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED: | 989 case ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED: |
| 976 ShowDeviceDisabledScreen(); | 990 OnAutoEnrollmentCheckCompleted(); |
| 977 break; | 991 break; |
| 978 case ENTERPRISE_ENROLLMENT_COMPLETED: | 992 case ENTERPRISE_ENROLLMENT_COMPLETED: |
| 979 OnEnrollmentDone(); | 993 OnEnrollmentDone(); |
| 980 break; | 994 break; |
| 981 case ENTERPRISE_ENROLLMENT_BACK: | 995 case ENTERPRISE_ENROLLMENT_BACK: |
| 982 ShowNetworkScreen(); | 996 ShowNetworkScreen(); |
| 983 break; | 997 break; |
| 984 case RESET_CANCELED: | 998 case RESET_CANCELED: |
| 985 OnResetCanceled(); | 999 OnResetCanceled(); |
| 986 break; | 1000 break; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1004 break; | 1018 break; |
| 1005 case WRONG_HWID_WARNING_SKIPPED: | 1019 case WRONG_HWID_WARNING_SKIPPED: |
| 1006 OnWrongHWIDWarningSkipped(); | 1020 OnWrongHWIDWarningSkipped(); |
| 1007 break; | 1021 break; |
| 1008 case CONTROLLER_PAIRING_FINISHED: | 1022 case CONTROLLER_PAIRING_FINISHED: |
| 1009 OnControllerPairingFinished(); | 1023 OnControllerPairingFinished(); |
| 1010 break; | 1024 break; |
| 1011 case HOST_PAIRING_FINISHED: | 1025 case HOST_PAIRING_FINISHED: |
| 1012 OnHostPairingFinished(); | 1026 OnHostPairingFinished(); |
| 1013 break; | 1027 break; |
| 1014 case DEVICE_NOT_DISABLED: | |
| 1015 OnDeviceNotDisabled(); | |
| 1016 break; | |
| 1017 default: | 1028 default: |
| 1018 NOTREACHED(); | 1029 NOTREACHED(); |
| 1019 } | 1030 } |
| 1020 } | 1031 } |
| 1021 | 1032 |
| 1022 void WizardController::ShowErrorScreen() { | 1033 void WizardController::ShowErrorScreen() { |
| 1023 VLOG(1) << "Showing error screen."; | 1034 VLOG(1) << "Showing error screen."; |
| 1024 SetCurrentScreen(GetScreen(kErrorScreenName)); | 1035 SetCurrentScreen(GetScreen(kErrorScreenName)); |
| 1025 } | 1036 } |
| 1026 | 1037 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 scoped_ptr<pairing_chromeos::HostPairingController> remora_controller) { | 1324 scoped_ptr<pairing_chromeos::HostPairingController> remora_controller) { |
| 1314 VLOG(1) << "OnSharkConnected"; | 1325 VLOG(1) << "OnSharkConnected"; |
| 1315 remora_controller_ = remora_controller.Pass(); | 1326 remora_controller_ = remora_controller.Pass(); |
| 1316 base::MessageLoop::current()->DeleteSoon( | 1327 base::MessageLoop::current()->DeleteSoon( |
| 1317 FROM_HERE, shark_connection_listener_.release()); | 1328 FROM_HERE, shark_connection_listener_.release()); |
| 1318 shark_controller_detected_ = true; | 1329 shark_controller_detected_ = true; |
| 1319 ShowHostPairingScreen(); | 1330 ShowHostPairingScreen(); |
| 1320 } | 1331 } |
| 1321 | 1332 |
| 1322 } // namespace chromeos | 1333 } // namespace chromeos |
| OLD | NEW |