| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } | 413 } |
| 414 | 414 |
| 415 void WizardController::SkipToLoginForTesting( | 415 void WizardController::SkipToLoginForTesting( |
| 416 const LoginScreenContext& context) { | 416 const LoginScreenContext& context) { |
| 417 StartupUtils::MarkEulaAccepted(); | 417 StartupUtils::MarkEulaAccepted(); |
| 418 PerformPostEulaActions(); | 418 PerformPostEulaActions(); |
| 419 PerformPostUpdateActions(); | 419 PerformPostUpdateActions(); |
| 420 ShowLoginScreen(context); | 420 ShowLoginScreen(context); |
| 421 } | 421 } |
| 422 | 422 |
| 423 void WizardController::SkipPostLoginScreensForTesting() { | |
| 424 skip_post_login_screens_ = true; | |
| 425 } | |
| 426 | |
| 427 void WizardController::AddObserver(Observer* observer) { | 423 void WizardController::AddObserver(Observer* observer) { |
| 428 observer_list_.AddObserver(observer); | 424 observer_list_.AddObserver(observer); |
| 429 } | 425 } |
| 430 | 426 |
| 431 void WizardController::RemoveObserver(Observer* observer) { | 427 void WizardController::RemoveObserver(Observer* observer) { |
| 432 observer_list_.RemoveObserver(observer); | 428 observer_list_.RemoveObserver(observer); |
| 433 } | 429 } |
| 434 | 430 |
| 435 void WizardController::OnSessionStart() { | 431 void WizardController::OnSessionStart() { |
| 436 FOR_EACH_OBSERVER(Observer, observer_list_, OnSessionStart()); | 432 FOR_EACH_OBSERVER(Observer, observer_list_, OnSessionStart()); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 ShowNetworkScreen(); | 712 ShowNetworkScreen(); |
| 717 } else { | 713 } else { |
| 718 ShowLoginScreen(LoginScreenContext()); | 714 ShowLoginScreen(LoginScreenContext()); |
| 719 } | 715 } |
| 720 } | 716 } |
| 721 } | 717 } |
| 722 | 718 |
| 723 /////////////////////////////////////////////////////////////////////////////// | 719 /////////////////////////////////////////////////////////////////////////////// |
| 724 // WizardController, chromeos::ScreenObserver overrides: | 720 // WizardController, chromeos::ScreenObserver overrides: |
| 725 void WizardController::OnExit(ExitCodes exit_code) { | 721 void WizardController::OnExit(ExitCodes exit_code) { |
| 726 LOG(INFO) << "Wizard screen exit code: " << exit_code; | 722 VLOG(1) << "Wizard screen exit code: " << exit_code; |
| 727 switch (exit_code) { | 723 switch (exit_code) { |
| 728 case NETWORK_CONNECTED: | 724 case NETWORK_CONNECTED: |
| 729 OnNetworkConnected(); | 725 OnNetworkConnected(); |
| 730 break; | 726 break; |
| 731 case CONNECTION_FAILED: | 727 case CONNECTION_FAILED: |
| 732 OnConnectionFailed(); | 728 OnConnectionFailed(); |
| 733 break; | 729 break; |
| 734 case UPDATE_INSTALLED: | 730 case UPDATE_INSTALLED: |
| 735 case UPDATE_NOUPDATE: | 731 case UPDATE_NOUPDATE: |
| 736 OnUpdateCompleted(); | 732 OnUpdateCompleted(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 | 816 |
| 821 void WizardController::AutoLaunchKioskApp() { | 817 void WizardController::AutoLaunchKioskApp() { |
| 822 KioskAppManager::App app_data; | 818 KioskAppManager::App app_data; |
| 823 std::string app_id = KioskAppManager::Get()->GetAutoLaunchApp(); | 819 std::string app_id = KioskAppManager::Get()->GetAutoLaunchApp(); |
| 824 CHECK(KioskAppManager::Get()->GetApp(app_id, &app_data)); | 820 CHECK(KioskAppManager::Get()->GetApp(app_id, &app_data)); |
| 825 | 821 |
| 826 host_->StartAppLaunch(app_id); | 822 host_->StartAppLaunch(app_id); |
| 827 } | 823 } |
| 828 | 824 |
| 829 // static | 825 // static |
| 826 void WizardController::SetZeroDelays() { |
| 827 kShowDelayMs = 0; |
| 828 zero_delay_enabled_ = true; |
| 829 } |
| 830 |
| 831 // static |
| 830 bool WizardController::IsZeroDelayEnabled() { | 832 bool WizardController::IsZeroDelayEnabled() { |
| 831 return zero_delay_enabled_; | 833 return zero_delay_enabled_; |
| 832 } | 834 } |
| 833 | 835 |
| 834 // static | 836 // static |
| 835 void WizardController::SetZeroDelays() { | 837 void WizardController::SkipPostLoginScreensForTesting() { |
| 836 kShowDelayMs = 0; | 838 skip_post_login_screens_ = true; |
| 837 zero_delay_enabled_ = true; | |
| 838 } | 839 } |
| 839 | 840 |
| 840 bool WizardController::ShouldAutoStartEnrollment() const { | 841 // static |
| 842 bool WizardController::ShouldAutoStartEnrollment() { |
| 841 return g_browser_process->browser_policy_connector()-> | 843 return g_browser_process->browser_policy_connector()-> |
| 842 GetDeviceCloudPolicyManager()->ShouldAutoStartEnrollment(); | 844 GetDeviceCloudPolicyManager()->ShouldAutoStartEnrollment(); |
| 843 } | 845 } |
| 844 | 846 |
| 845 bool WizardController::CanExitEnrollment() const { | 847 bool WizardController::CanExitEnrollment() const { |
| 846 return g_browser_process->browser_policy_connector()-> | 848 return g_browser_process->browser_policy_connector()-> |
| 847 GetDeviceCloudPolicyManager()->CanExitEnrollment(); | 849 GetDeviceCloudPolicyManager()->CanExitEnrollment(); |
| 848 } | 850 } |
| 849 | 851 |
| 850 void WizardController::OnLocalStateInitialized(bool /* succeeded */) { | 852 void WizardController::OnLocalStateInitialized(bool /* succeeded */) { |
| 851 if (GetLocalState()->GetInitializationStatus() != | 853 if (GetLocalState()->GetInitializationStatus() != |
| 852 PrefService::INITIALIZATION_STATUS_ERROR) { | 854 PrefService::INITIALIZATION_STATUS_ERROR) { |
| 853 return; | 855 return; |
| 854 } | 856 } |
| 855 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_LOCAL_STATE_ERROR); | 857 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_LOCAL_STATE_ERROR); |
| 856 SetStatusAreaVisible(false); | 858 SetStatusAreaVisible(false); |
| 857 ShowErrorScreen(); | 859 ShowErrorScreen(); |
| 858 } | 860 } |
| 859 | 861 |
| 860 PrefService* WizardController::GetLocalState() { | 862 PrefService* WizardController::GetLocalState() { |
| 861 if (local_state_for_testing_) | 863 if (local_state_for_testing_) |
| 862 return local_state_for_testing_; | 864 return local_state_for_testing_; |
| 863 return g_browser_process->local_state(); | 865 return g_browser_process->local_state(); |
| 864 } | 866 } |
| 865 | 867 |
| 866 } // namespace chromeos | 868 } // namespace chromeos |
| OLD | NEW |