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