| 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/command_line.h" | 15 #include "base/command_line.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/threading/thread_restrictions.h" | 20 #include "base/threading/thread_restrictions.h" |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "chrome/app/breakpad_linux.h" | 22 #include "chrome/app/breakpad_linux.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/chromeos/app_mode/kiosk_app_launcher.h" | 24 #include "chrome/browser/chrome_notification_types.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/login/enrollment/enrollment_screen.h" | 27 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" |
| 28 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 28 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 29 #include "chrome/browser/chromeos/login/helper.h" | 29 #include "chrome/browser/chromeos/login/helper.h" |
| 30 #include "chrome/browser/chromeos/login/hwid_checker.h" | 30 #include "chrome/browser/chromeos/login/hwid_checker.h" |
| 31 #include "chrome/browser/chromeos/login/login_display_host.h" | 31 #include "chrome/browser/chromeos/login/login_display_host.h" |
| 32 #include "chrome/browser/chromeos/login/login_utils.h" | 32 #include "chrome/browser/chromeos/login/login_utils.h" |
| 33 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc
reen.h" | 33 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc
reen.h" |
| 34 #include "chrome/browser/chromeos/login/oobe_display.h" | 34 #include "chrome/browser/chromeos/login/oobe_display.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 const char WizardController::kEulaScreenName[] = "eula"; | 115 const char WizardController::kEulaScreenName[] = "eula"; |
| 116 const char WizardController::kEnrollmentScreenName[] = "enroll"; | 116 const char WizardController::kEnrollmentScreenName[] = "enroll"; |
| 117 const char WizardController::kResetScreenName[] = "reset"; | 117 const char WizardController::kResetScreenName[] = "reset"; |
| 118 const char WizardController::kKioskEnableScreenName[] = "kiosk-enable"; | 118 const char WizardController::kKioskEnableScreenName[] = "kiosk-enable"; |
| 119 const char WizardController::kKioskAutolaunchScreenName[] = "autolaunch"; | 119 const char WizardController::kKioskAutolaunchScreenName[] = "autolaunch"; |
| 120 const char WizardController::kErrorScreenName[] = "error-message"; | 120 const char WizardController::kErrorScreenName[] = "error-message"; |
| 121 const char WizardController::kTermsOfServiceScreenName[] = "tos"; | 121 const char WizardController::kTermsOfServiceScreenName[] = "tos"; |
| 122 const char WizardController::kWrongHWIDScreenName[] = "wrong-hwid"; | 122 const char WizardController::kWrongHWIDScreenName[] = "wrong-hwid"; |
| 123 const char WizardController::kLocallyManagedUserCreationScreenName[] = | 123 const char WizardController::kLocallyManagedUserCreationScreenName[] = |
| 124 "locally-managed-user-creation-flow"; | 124 "locally-managed-user-creation-flow"; |
| 125 const char WizardController::kAppLaunchSplashScreenName[] = |
| 126 "app-launch-splash"; |
| 125 | 127 |
| 126 // Passing this parameter as a "first screen" initiates full OOBE flow. | 128 // Passing this parameter as a "first screen" initiates full OOBE flow. |
| 127 const char WizardController::kOutOfBoxScreenName[] = "oobe"; | 129 const char WizardController::kOutOfBoxScreenName[] = "oobe"; |
| 128 | 130 |
| 129 // Special test value that commands not to create any window yet. | 131 // Special test value that commands not to create any window yet. |
| 130 const char WizardController::kTestNoScreenName[] = "test:nowindow"; | 132 const char WizardController::kTestNoScreenName[] = "test:nowindow"; |
| 131 | 133 |
| 132 // Initialize default controller. | 134 // Initialize default controller. |
| 133 // static | 135 // static |
| 134 WizardController* WizardController::default_controller_ = NULL; | 136 WizardController* WizardController::default_controller_ = NULL; |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 } else if (screen_name == kKioskAutolaunchScreenName) { | 712 } else if (screen_name == kKioskAutolaunchScreenName) { |
| 711 ShowKioskAutolaunchScreen(); | 713 ShowKioskAutolaunchScreen(); |
| 712 } else if (screen_name == kEnrollmentScreenName) { | 714 } else if (screen_name == kEnrollmentScreenName) { |
| 713 ShowEnrollmentScreen(); | 715 ShowEnrollmentScreen(); |
| 714 } else if (screen_name == kTermsOfServiceScreenName) { | 716 } else if (screen_name == kTermsOfServiceScreenName) { |
| 715 ShowTermsOfServiceScreen(); | 717 ShowTermsOfServiceScreen(); |
| 716 } else if (screen_name == kWrongHWIDScreenName) { | 718 } else if (screen_name == kWrongHWIDScreenName) { |
| 717 ShowWrongHWIDScreen(); | 719 ShowWrongHWIDScreen(); |
| 718 } else if (screen_name == kLocallyManagedUserCreationScreenName) { | 720 } else if (screen_name == kLocallyManagedUserCreationScreenName) { |
| 719 ShowLocallyManagedUserCreationScreen(); | 721 ShowLocallyManagedUserCreationScreen(); |
| 722 } else if (screen_name == kAppLaunchSplashScreenName) { |
| 723 AutoLaunchKioskApp(); |
| 720 } else if (screen_name != kTestNoScreenName) { | 724 } else if (screen_name != kTestNoScreenName) { |
| 721 if (is_out_of_box_) { | 725 if (is_out_of_box_) { |
| 722 ShowNetworkScreen(); | 726 ShowNetworkScreen(); |
| 723 } else { | 727 } else { |
| 724 ShowLoginScreen(); | 728 ShowLoginScreen(); |
| 725 } | 729 } |
| 726 } | 730 } |
| 727 } | 731 } |
| 728 | 732 |
| 729 /////////////////////////////////////////////////////////////////////////////// | 733 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 void WizardController::HideErrorScreen(WizardScreen* parent_screen) { | 822 void WizardController::HideErrorScreen(WizardScreen* parent_screen) { |
| 819 DCHECK(parent_screen); | 823 DCHECK(parent_screen); |
| 820 VLOG(1) << "Hiding error screen."; | 824 VLOG(1) << "Hiding error screen."; |
| 821 SetCurrentScreen(parent_screen); | 825 SetCurrentScreen(parent_screen); |
| 822 } | 826 } |
| 823 | 827 |
| 824 void WizardController::AutoLaunchKioskApp() { | 828 void WizardController::AutoLaunchKioskApp() { |
| 825 KioskAppManager::App app_data; | 829 KioskAppManager::App app_data; |
| 826 std::string app_id = KioskAppManager::Get()->GetAutoLaunchApp(); | 830 std::string app_id = KioskAppManager::Get()->GetAutoLaunchApp(); |
| 827 CHECK(KioskAppManager::Get()->GetApp(app_id, &app_data)); | 831 CHECK(KioskAppManager::Get()->GetApp(app_id, &app_data)); |
| 828 if (ExistingUserController::current_controller()) | |
| 829 ExistingUserController::current_controller()->PrepareKioskAppLaunch(); | |
| 830 | 832 |
| 831 // KioskAppLauncher deletes itself when done. | 833 host_->StartAppLaunch(app_id); |
| 832 (new KioskAppLauncher(KioskAppManager::Get(), app_id))->Start(); | |
| 833 } | 834 } |
| 834 | 835 |
| 835 // static | 836 // static |
| 836 bool WizardController::IsZeroDelayEnabled() { | 837 bool WizardController::IsZeroDelayEnabled() { |
| 837 return zero_delay_enabled_; | 838 return zero_delay_enabled_; |
| 838 } | 839 } |
| 839 | 840 |
| 840 // static | 841 // static |
| 841 void WizardController::SetZeroDelays() { | 842 void WizardController::SetZeroDelays() { |
| 842 kShowDelayMs = 0; | 843 kShowDelayMs = 0; |
| 843 zero_delay_enabled_ = true; | 844 zero_delay_enabled_ = true; |
| 844 } | 845 } |
| 845 | 846 |
| 846 bool WizardController::ShouldAutoStartEnrollment() const { | 847 bool WizardController::ShouldAutoStartEnrollment() const { |
| 847 return g_browser_process->browser_policy_connector()-> | 848 return g_browser_process->browser_policy_connector()-> |
| 848 GetDeviceCloudPolicyManager()->ShouldAutoStartEnrollment(); | 849 GetDeviceCloudPolicyManager()->ShouldAutoStartEnrollment(); |
| 849 } | 850 } |
| 850 | 851 |
| 851 bool WizardController::CanExitEnrollment() const { | 852 bool WizardController::CanExitEnrollment() const { |
| 852 return g_browser_process->browser_policy_connector()-> | 853 return g_browser_process->browser_policy_connector()-> |
| 853 GetDeviceCloudPolicyManager()->CanExitEnrollment(); | 854 GetDeviceCloudPolicyManager()->CanExitEnrollment(); |
| 854 } | 855 } |
| 855 | 856 |
| 856 } // namespace chromeos | 857 } // namespace chromeos |
| OLD | NEW |