| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class PrefService; | 22 class PrefService; |
| 23 class WizardContentsView; | 23 class WizardContentsView; |
| 24 class WizardScreen; | 24 class WizardScreen; |
| 25 | 25 |
| 26 namespace chromeos { | 26 namespace chromeos { |
| 27 class AccountScreen; | 27 class AccountScreen; |
| 28 class BackgroundView; | 28 class BackgroundView; |
| 29 class EulaScreen; | 29 class EulaScreen; |
| 30 class ExistingUserController; | 30 class ExistingUserController; |
| 31 class HTMLPageScreen; | 31 class HTMLPageScreen; |
| 32 class LoginScreen; | |
| 33 class NetworkScreen; | 32 class NetworkScreen; |
| 34 class RegistrationScreen; | 33 class RegistrationScreen; |
| 35 class StartupCustomizationDocument; | 34 class StartupCustomizationDocument; |
| 36 class UpdateScreen; | 35 class UpdateScreen; |
| 37 class UserImageScreen; | 36 class UserImageScreen; |
| 38 } | 37 } |
| 39 | 38 |
| 40 namespace gfx { | 39 namespace gfx { |
| 41 class Rect; | 40 class Rect; |
| 42 } | 41 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 74 |
| 76 // Returns device registration completion status, i.e. second part of OOBE. | 75 // Returns device registration completion status, i.e. second part of OOBE. |
| 77 static bool IsDeviceRegistered(); | 76 static bool IsDeviceRegistered(); |
| 78 | 77 |
| 79 // Returns true if valid registration URL is defined. | 78 // Returns true if valid registration URL is defined. |
| 80 static bool IsRegisterScreenDefined(); | 79 static bool IsRegisterScreenDefined(); |
| 81 | 80 |
| 82 // Marks device registered. i.e. second part of OOBE is completed. | 81 // Marks device registered. i.e. second part of OOBE is completed. |
| 83 static void MarkDeviceRegistered(); | 82 static void MarkDeviceRegistered(); |
| 84 | 83 |
| 84 // Returns true if run under automation test. |
| 85 // TODO(avayvod): Figure out the way to remove this. Fix the tests that |
| 86 // rely on this functionality. |
| 87 static bool IsAutomationTest(); |
| 88 |
| 85 // Shows the first screen defined by |first_screen_name| or by default | 89 // Shows the first screen defined by |first_screen_name| or by default |
| 86 // if the parameter is empty. |screen_bounds| are used to calculate position | 90 // if the parameter is empty. |screen_bounds| are used to calculate position |
| 87 // of the wizard screen. | 91 // of the wizard screen. |
| 88 void Init(const std::string& first_screen_name, | 92 void Init(const std::string& first_screen_name, |
| 89 const gfx::Rect& screen_bounds); | 93 const gfx::Rect& screen_bounds); |
| 90 | 94 |
| 91 // Returns the view that contains all the other views. | 95 // Returns the view that contains all the other views. |
| 92 views::View* contents() { return contents_; } | 96 views::View* contents() { return contents_; } |
| 93 | 97 |
| 94 // Shows the wizard controller in a window. | 98 // Shows the wizard controller in a window. |
| 95 void Show(); | 99 void Show(); |
| 96 | 100 |
| 97 // Creates and shows a background window. | 101 // Creates and shows a background window. |
| 98 void ShowBackground(const gfx::Rect& bounds); | 102 void ShowBackground(const gfx::Rect& bounds); |
| 99 | 103 |
| 100 // Takes ownership of the specified background widget and view. | 104 // Takes ownership of the specified background widget and view. |
| 101 void OwnBackground(views::Widget* background_widget, | 105 void OwnBackground(views::Widget* background_widget, |
| 102 chromeos::BackgroundView* background_view); | 106 chromeos::BackgroundView* background_view); |
| 103 | 107 |
| 104 // Skips OOBE update screen if it's currently shown. | 108 // Skips OOBE update screen if it's currently shown. |
| 105 void CancelOOBEUpdate(); | 109 void CancelOOBEUpdate(); |
| 106 | 110 |
| 107 // Lazy initializers and getters for screens. | 111 // Lazy initializers and getters for screens. |
| 108 chromeos::NetworkScreen* GetNetworkScreen(); | 112 chromeos::NetworkScreen* GetNetworkScreen(); |
| 109 chromeos::LoginScreen* GetLoginScreen(); | |
| 110 chromeos::AccountScreen* GetAccountScreen(); | 113 chromeos::AccountScreen* GetAccountScreen(); |
| 111 chromeos::UpdateScreen* GetUpdateScreen(); | 114 chromeos::UpdateScreen* GetUpdateScreen(); |
| 112 chromeos::UserImageScreen* GetUserImageScreen(); | 115 chromeos::UserImageScreen* GetUserImageScreen(); |
| 113 chromeos::EulaScreen* GetEulaScreen(); | 116 chromeos::EulaScreen* GetEulaScreen(); |
| 114 chromeos::RegistrationScreen* GetRegistrationScreen(); | 117 chromeos::RegistrationScreen* GetRegistrationScreen(); |
| 115 chromeos::HTMLPageScreen* GetHTMLPageScreen(); | 118 chromeos::HTMLPageScreen* GetHTMLPageScreen(); |
| 116 | 119 |
| 117 // Show specific screen. | 120 // Show specific screen. |
| 118 void ShowNetworkScreen(); | 121 void ShowNetworkScreen(); |
| 119 void ShowAccountScreen(); | 122 void ShowAccountScreen(); |
| 120 void ShowUpdateScreen(); | 123 void ShowUpdateScreen(); |
| 121 void ShowUserImageScreen(); | 124 void ShowUserImageScreen(); |
| 122 void ShowEulaScreen(); | 125 void ShowEulaScreen(); |
| 123 void ShowRegistrationScreen(); | 126 void ShowRegistrationScreen(); |
| 124 void ShowHTMLPageScreen(); | 127 void ShowHTMLPageScreen(); |
| 125 // Shows the default login screen and returns NULL or shows images login | 128 // Shows images login screen and returns the corresponding controller |
| 126 // screen and returns the corresponding controller instance for optional | 129 // instance for optional tweaking. |
| 127 // tweaking. | |
| 128 chromeos::ExistingUserController* ShowLoginScreen(); | 130 chromeos::ExistingUserController* ShowLoginScreen(); |
| 129 | 131 |
| 130 // Returns a pointer to the current screen or NULL if there's no such | 132 // Returns a pointer to the current screen or NULL if there's no such |
| 131 // screen. | 133 // screen. |
| 132 WizardScreen* current_screen() const { return current_screen_; } | 134 WizardScreen* current_screen() const { return current_screen_; } |
| 133 | 135 |
| 134 // Overrides observer for testing. | 136 // Overrides observer for testing. |
| 135 void set_observer(ScreenObserver* observer) { observer_ = observer; } | 137 void set_observer(ScreenObserver* observer) { observer_ = observer; } |
| 136 | 138 |
| 137 // Set URL to open on browser launch. | 139 // Set URL to open on browser launch. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 162 static const char kEulaScreenName[]; | 164 static const char kEulaScreenName[]; |
| 163 static const char kHTMLPageScreenName[]; | 165 static const char kHTMLPageScreenName[]; |
| 164 | 166 |
| 165 // NotificationObserver implementation: | 167 // NotificationObserver implementation: |
| 166 virtual void Observe(NotificationType type, | 168 virtual void Observe(NotificationType type, |
| 167 const NotificationSource& source, | 169 const NotificationSource& source, |
| 168 const NotificationDetails& details); | 170 const NotificationDetails& details); |
| 169 | 171 |
| 170 private: | 172 private: |
| 171 // Exit handlers: | 173 // Exit handlers: |
| 172 void OnLoginSignInSelected(); | |
| 173 void OnLoginGuestUser(); | |
| 174 void OnLoginCreateAccount(); | |
| 175 void OnNetworkConnected(); | 174 void OnNetworkConnected(); |
| 176 void OnNetworkOffline(); | 175 void OnNetworkOffline(); |
| 177 void OnAccountCreateBack(); | 176 void OnAccountCreateBack(); |
| 178 void OnAccountCreated(); | 177 void OnAccountCreated(); |
| 179 void OnConnectionFailed(); | 178 void OnConnectionFailed(); |
| 180 void OnUpdateCompleted(); | 179 void OnUpdateCompleted(); |
| 181 void OnEulaAccepted(); | 180 void OnEulaAccepted(); |
| 182 void OnUpdateErrorCheckingForUpdate(); | 181 void OnUpdateErrorCheckingForUpdate(); |
| 183 void OnUpdateErrorUpdating(); | 182 void OnUpdateErrorUpdating(); |
| 184 void OnUserImageSelected(); | 183 void OnUserImageSelected(); |
| 185 void OnUserImageSkipped(); | 184 void OnUserImageSkipped(); |
| 186 void OnRegistrationSuccess(); | 185 void OnRegistrationSuccess(); |
| 187 void OnRegistrationSkipped(); | 186 void OnRegistrationSkipped(); |
| 188 void OnOOBECompleted(); | 187 void OnOOBECompleted(); |
| 189 | 188 |
| 190 // Shows update screen and starts update process. | 189 // Shows update screen and starts update process. |
| 191 void InitiateOOBEUpdate(); | 190 void InitiateOOBEUpdate(); |
| 192 | 191 |
| 192 // Overridden from chromeos::ScreenObserver: |
| 193 virtual void OnExit(ExitCodes exit_code); |
| 194 virtual void OnSetUserNamePassword(const std::string& username, |
| 195 const std::string& password); |
| 196 |
| 193 // Creates wizard screen window with the specified |bounds|. | 197 // Creates wizard screen window with the specified |bounds|. |
| 194 // If |initial_show| initial animation (window & background) is shown. | 198 // If |initial_show| initial animation (window & background) is shown. |
| 195 // Otherwise only window is animated. | 199 // Otherwise only window is animated. |
| 196 views::WidgetGtk* CreateScreenWindow(const gfx::Rect& bounds, | 200 views::WidgetGtk* CreateScreenWindow(const gfx::Rect& bounds, |
| 197 bool initial_show); | 201 bool initial_show); |
| 198 | 202 |
| 199 // Returns bounds for the wizard screen host window in screen coordinates. | 203 // Returns bounds for the wizard screen host window in screen coordinates. |
| 200 // Calculates bounds using screen_bounds_. | 204 // Calculates bounds using screen_bounds_. |
| 201 gfx::Rect GetWizardScreenBounds(int screen_width, int screen_height) const; | 205 gfx::Rect GetWizardScreenBounds(int screen_width, int screen_height) const; |
| 202 | 206 |
| 203 // Switches from one screen to another. | 207 // Switches from one screen to another. |
| 204 void SetCurrentScreen(WizardScreen* screen); | 208 void SetCurrentScreen(WizardScreen* screen); |
| 205 | 209 |
| 206 // Changes status area visibility. | 210 // Changes status area visibility. |
| 207 void SetStatusAreaVisible(bool visible); | 211 void SetStatusAreaVisible(bool visible); |
| 208 | 212 |
| 209 // Overridden from chromeos::ScreenObserver: | |
| 210 virtual void OnExit(ExitCodes exit_code); | |
| 211 virtual void OnSetUserNamePassword(const std::string& username, | |
| 212 const std::string& password); | |
| 213 | |
| 214 // Overridden from WizardScreenDelegate: | 213 // Overridden from WizardScreenDelegate: |
| 215 virtual views::View* GetWizardView(); | 214 virtual views::View* GetWizardView(); |
| 216 virtual chromeos::ScreenObserver* GetObserver(WizardScreen* screen); | 215 virtual chromeos::ScreenObserver* GetObserver(WizardScreen* screen); |
| 217 | 216 |
| 218 // Determines which screen to show first by the parameter, shows it and | 217 // Determines which screen to show first by the parameter, shows it and |
| 219 // sets it as the current one. | 218 // sets it as the current one. |
| 220 void ShowFirstScreen(const std::string& first_screen_name); | 219 void ShowFirstScreen(const std::string& first_screen_name); |
| 221 | 220 |
| 222 // Logs in the specified user via default login screen. | 221 // Logs in the specified user via default login screen. |
| 223 void Login(const std::string& username, const std::string& password); | 222 void Login(const std::string& username, const std::string& password); |
| 224 | 223 |
| 225 // Widget we're showing in. | 224 // Widget we're showing in. |
| 226 views::Widget* widget_; | 225 views::Widget* widget_; |
| 227 | 226 |
| 228 // Used to render the background. | 227 // Used to render the background. |
| 229 views::Widget* background_widget_; | 228 views::Widget* background_widget_; |
| 230 chromeos::BackgroundView* background_view_; | 229 chromeos::BackgroundView* background_view_; |
| 231 | 230 |
| 232 // Contents view. | 231 // Contents view. |
| 233 views::View* contents_; | 232 views::View* contents_; |
| 234 | 233 |
| 235 // Used to calculate position of the wizard screen. | 234 // Used to calculate position of the wizard screen. |
| 236 gfx::Rect screen_bounds_; | 235 gfx::Rect screen_bounds_; |
| 237 | 236 |
| 238 // Screens. | 237 // Screens. |
| 239 scoped_ptr<chromeos::NetworkScreen> network_screen_; | 238 scoped_ptr<chromeos::NetworkScreen> network_screen_; |
| 240 scoped_ptr<chromeos::LoginScreen> login_screen_; | |
| 241 scoped_ptr<chromeos::AccountScreen> account_screen_; | 239 scoped_ptr<chromeos::AccountScreen> account_screen_; |
| 242 scoped_ptr<chromeos::UpdateScreen> update_screen_; | 240 scoped_ptr<chromeos::UpdateScreen> update_screen_; |
| 243 scoped_ptr<chromeos::UserImageScreen> user_image_screen_; | 241 scoped_ptr<chromeos::UserImageScreen> user_image_screen_; |
| 244 scoped_ptr<chromeos::EulaScreen> eula_screen_; | 242 scoped_ptr<chromeos::EulaScreen> eula_screen_; |
| 245 scoped_ptr<chromeos::RegistrationScreen> registration_screen_; | 243 scoped_ptr<chromeos::RegistrationScreen> registration_screen_; |
| 246 scoped_ptr<chromeos::HTMLPageScreen> html_page_screen_; | 244 scoped_ptr<chromeos::HTMLPageScreen> html_page_screen_; |
| 247 | 245 |
| 248 // Screen that's currently active. | 246 // Screen that's currently active. |
| 249 WizardScreen* current_screen_; | 247 WizardScreen* current_screen_; |
| 250 | 248 |
| 251 std::string username_; | 249 std::string username_; |
| 252 std::string password_; | 250 std::string password_; |
| 253 | 251 |
| 254 // True if running official BUILD. | 252 // True if running official BUILD. |
| 255 bool is_official_build_; | 253 bool is_official_build_; |
| 256 | 254 |
| 257 // True if full OOBE flow should be shown. | 255 // True if full OOBE flow should be shown. |
| 258 bool is_out_of_box_; | 256 bool is_out_of_box_; |
| 259 | 257 |
| 260 // True if this is run under automation test and we need to show only | |
| 261 // login screen. | |
| 262 bool is_test_mode_; | |
| 263 | |
| 264 // Value of the screen name that WizardController was started with. | 258 // Value of the screen name that WizardController was started with. |
| 265 std::string first_screen_name_; | 259 std::string first_screen_name_; |
| 266 | 260 |
| 267 // NULL by default - controller itself is observer. Mock could be assigned. | 261 // NULL by default - controller itself is observer. Mock could be assigned. |
| 268 ScreenObserver* observer_; | 262 ScreenObserver* observer_; |
| 269 | 263 |
| 270 // Default WizardController. | 264 // Default WizardController. |
| 271 static WizardController* default_controller_; | 265 static WizardController* default_controller_; |
| 272 | 266 |
| 273 // Partner startup customizations. | 267 // Partner startup customizations. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 286 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, | 280 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, |
| 287 ControlFlowLanguageOnNetwork); | 281 ControlFlowLanguageOnNetwork); |
| 288 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowMain); | 282 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowMain); |
| 289 FRIEND_TEST_ALL_PREFIXES(WizardControllerTest, SwitchLanguage); | 283 FRIEND_TEST_ALL_PREFIXES(WizardControllerTest, SwitchLanguage); |
| 290 friend class WizardControllerFlowTest; | 284 friend class WizardControllerFlowTest; |
| 291 | 285 |
| 292 DISALLOW_COPY_AND_ASSIGN(WizardController); | 286 DISALLOW_COPY_AND_ASSIGN(WizardController); |
| 293 }; | 287 }; |
| 294 | 288 |
| 295 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ | 289 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
| OLD | NEW |