| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "chrome/browser/chromeos/login/screen_observer.h" | 12 #include "chrome/browser/chromeos/login/screen_observer.h" |
| 13 #include "chrome/browser/chromeos/login/view_screen.h" | 13 #include "chrome/browser/chromeos/login/view_screen.h" |
| 14 #include "chrome/browser/chromeos/login/wizard_screen.h" | 14 #include "chrome/browser/chromeos/login/wizard_screen.h" |
| 15 #include "testing/gtest/include/gtest/gtest_prod.h" | 15 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 16 | 16 |
| 17 class PrefService; | 17 class PrefService; |
| 18 class WizardContentsView; | 18 class WizardContentsView; |
| 19 class WizardScreen; | 19 class WizardScreen; |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 class AccountScreen; | 22 class AccountScreen; |
| 23 class BackgroundView; | 23 class BackgroundView; |
| 24 class EulaScreen; |
| 24 class LoginScreen; | 25 class LoginScreen; |
| 25 class NetworkScreen; | 26 class NetworkScreen; |
| 26 class RegistrationScreen; | 27 class RegistrationScreen; |
| 28 class StartupCustomizationDocument; |
| 29 class UpdateScreen; |
| 27 class UserImageScreen; | 30 class UserImageScreen; |
| 28 class UpdateScreen; | |
| 29 class StartupCustomizationDocument; | |
| 30 } | 31 } |
| 31 | 32 |
| 32 namespace gfx { | 33 namespace gfx { |
| 33 class Rect; | 34 class Rect; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace views { | 37 namespace views { |
| 37 class Views; | 38 class Views; |
| 38 class Widget; | 39 class Widget; |
| 39 } | 40 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 69 // Takes ownership of the specified background widget and view. | 70 // Takes ownership of the specified background widget and view. |
| 70 void OwnBackground(views::Widget* background_widget, | 71 void OwnBackground(views::Widget* background_widget, |
| 71 chromeos::BackgroundView* background_view); | 72 chromeos::BackgroundView* background_view); |
| 72 | 73 |
| 73 // Lazy initializers and getters for screens. | 74 // Lazy initializers and getters for screens. |
| 74 chromeos::NetworkScreen* GetNetworkScreen(); | 75 chromeos::NetworkScreen* GetNetworkScreen(); |
| 75 chromeos::LoginScreen* GetLoginScreen(); | 76 chromeos::LoginScreen* GetLoginScreen(); |
| 76 chromeos::AccountScreen* GetAccountScreen(); | 77 chromeos::AccountScreen* GetAccountScreen(); |
| 77 chromeos::UpdateScreen* GetUpdateScreen(); | 78 chromeos::UpdateScreen* GetUpdateScreen(); |
| 78 chromeos::UserImageScreen* GetUserImageScreen(); | 79 chromeos::UserImageScreen* GetUserImageScreen(); |
| 80 chromeos::EulaScreen* GetEulaScreen(); |
| 79 chromeos::RegistrationScreen* GetRegistrationScreen(); | 81 chromeos::RegistrationScreen* GetRegistrationScreen(); |
| 80 | 82 |
| 81 // Show specific screen. | 83 // Show specific screen. |
| 82 void ShowNetworkScreen(); | 84 void ShowNetworkScreen(); |
| 83 void ShowLoginScreen(); | 85 void ShowLoginScreen(); |
| 84 void ShowAccountScreen(); | 86 void ShowAccountScreen(); |
| 85 void ShowUpdateScreen(); | 87 void ShowUpdateScreen(); |
| 86 void ShowUserImageScreen(); | 88 void ShowUserImageScreen(); |
| 89 void ShowEulaScreen(); |
| 87 void ShowRegistrationScreen(); | 90 void ShowRegistrationScreen(); |
| 88 | 91 |
| 89 // Returns a pointer to the current screen or NULL if there's no such | 92 // Returns a pointer to the current screen or NULL if there's no such |
| 90 // screen. | 93 // screen. |
| 91 WizardScreen* current_screen() const { return current_screen_; } | 94 WizardScreen* current_screen() const { return current_screen_; } |
| 92 | 95 |
| 93 // Overrides observer for testing. | 96 // Overrides observer for testing. |
| 94 void set_observer(ScreenObserver* observer) { observer_ = observer; } | 97 void set_observer(ScreenObserver* observer) { observer_ = observer; } |
| 95 | 98 |
| 96 // Sets partner startup customization. WizardController takes ownership | 99 // Sets partner startup customization. WizardController takes ownership |
| 97 // of the document object. | 100 // of the document object. |
| 98 void SetCustomization( | 101 void SetCustomization( |
| 99 const chromeos::StartupCustomizationDocument* customization); | 102 const chromeos::StartupCustomizationDocument* customization); |
| 100 | 103 |
| 101 // Registers OOBE preferences. | 104 // Registers OOBE preferences. |
| 102 static void RegisterPrefs(PrefService* local_state); | 105 static void RegisterPrefs(PrefService* local_state); |
| 103 | 106 |
| 104 static const char kNetworkScreenName[]; | 107 static const char kNetworkScreenName[]; |
| 105 static const char kLoginScreenName[]; | 108 static const char kLoginScreenName[]; |
| 106 static const char kAccountScreenName[]; | 109 static const char kAccountScreenName[]; |
| 107 static const char kUpdateScreenName[]; | 110 static const char kUpdateScreenName[]; |
| 108 static const char kUserImageScreenName[]; | 111 static const char kUserImageScreenName[]; |
| 109 static const char kRegistrationScreenName[]; | 112 static const char kRegistrationScreenName[]; |
| 110 static const char kOutOfBoxScreenName[]; | 113 static const char kOutOfBoxScreenName[]; |
| 111 static const char kTestNoScreenName[]; | 114 static const char kTestNoScreenName[]; |
| 115 static const char kEulaScreenName[]; |
| 112 | 116 |
| 113 private: | 117 private: |
| 114 // Exit handlers: | 118 // Exit handlers: |
| 115 void OnLoginSignInSelected(); | 119 void OnLoginSignInSelected(); |
| 116 void OnLoginGuestUser(); | 120 void OnLoginGuestUser(); |
| 117 void OnLoginCreateAccount(); | 121 void OnLoginCreateAccount(); |
| 118 void OnNetworkConnected(); | 122 void OnNetworkConnected(); |
| 119 void OnNetworkOffline(); | 123 void OnNetworkOffline(); |
| 120 void OnAccountCreateBack(); | 124 void OnAccountCreateBack(); |
| 121 void OnAccountCreated(); | 125 void OnAccountCreated(); |
| 122 void OnConnectionFailed(); | 126 void OnConnectionFailed(); |
| 123 void OnUpdateCompleted(); | 127 void OnUpdateCompleted(); |
| 128 void OnEulaAccepted(); |
| 124 void OnUpdateErrorCheckingForUpdate(); | 129 void OnUpdateErrorCheckingForUpdate(); |
| 125 void OnUpdateErrorUpdating(); | 130 void OnUpdateErrorUpdating(); |
| 126 void OnUserImageSelected(); | 131 void OnUserImageSelected(); |
| 127 void OnUserImageSkipped(); | 132 void OnUserImageSkipped(); |
| 128 | 133 |
| 129 // Switches from one screen to another. | 134 // Switches from one screen to another. |
| 130 void SetCurrentScreen(WizardScreen* screen); | 135 void SetCurrentScreen(WizardScreen* screen); |
| 131 | 136 |
| 132 // Changes status area visibility. | 137 // Changes status area visibility. |
| 133 void SetStatusAreaVisible(bool visible); | 138 void SetStatusAreaVisible(bool visible); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 157 | 162 |
| 158 // Contents view. | 163 // Contents view. |
| 159 views::View* contents_; | 164 views::View* contents_; |
| 160 | 165 |
| 161 // Screens. | 166 // Screens. |
| 162 scoped_ptr<chromeos::NetworkScreen> network_screen_; | 167 scoped_ptr<chromeos::NetworkScreen> network_screen_; |
| 163 scoped_ptr<chromeos::LoginScreen> login_screen_; | 168 scoped_ptr<chromeos::LoginScreen> login_screen_; |
| 164 scoped_ptr<chromeos::AccountScreen> account_screen_; | 169 scoped_ptr<chromeos::AccountScreen> account_screen_; |
| 165 scoped_ptr<chromeos::UpdateScreen> update_screen_; | 170 scoped_ptr<chromeos::UpdateScreen> update_screen_; |
| 166 scoped_ptr<chromeos::UserImageScreen> user_image_screen_; | 171 scoped_ptr<chromeos::UserImageScreen> user_image_screen_; |
| 172 scoped_ptr<chromeos::EulaScreen> eula_screen_; |
| 167 scoped_ptr<chromeos::RegistrationScreen> registration_screen_; | 173 scoped_ptr<chromeos::RegistrationScreen> registration_screen_; |
| 168 | 174 |
| 169 // Screen that's currently active. | 175 // Screen that's currently active. |
| 170 WizardScreen* current_screen_; | 176 WizardScreen* current_screen_; |
| 171 | 177 |
| 172 std::string username_; | 178 std::string username_; |
| 173 std::string password_; | 179 std::string password_; |
| 174 | 180 |
| 175 // True if full OOBE flow should be shown. | 181 // True if full OOBE flow should be shown. |
| 176 bool is_out_of_box_; | 182 bool is_out_of_box_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 195 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, | 201 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, |
| 196 ControlFlowLanguageOnNetwork); | 202 ControlFlowLanguageOnNetwork); |
| 197 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowMain); | 203 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowMain); |
| 198 FRIEND_TEST_ALL_PREFIXES(WizardControllerTest, SwitchLanguage); | 204 FRIEND_TEST_ALL_PREFIXES(WizardControllerTest, SwitchLanguage); |
| 199 friend class WizardControllerFlowTest; | 205 friend class WizardControllerFlowTest; |
| 200 | 206 |
| 201 DISALLOW_COPY_AND_ASSIGN(WizardController); | 207 DISALLOW_COPY_AND_ASSIGN(WizardController); |
| 202 }; | 208 }; |
| 203 | 209 |
| 204 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ | 210 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
| OLD | NEW |