| 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 #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 <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // Class that manages control flow between wizard screens. Wizard controller | 51 // Class that manages control flow between wizard screens. Wizard controller |
| 52 // interacts with screen controllers to move the user between screens. | 52 // interacts with screen controllers to move the user between screens. |
| 53 class WizardController : public BaseScreenDelegate, | 53 class WizardController : public BaseScreenDelegate, |
| 54 public ScreenManager, | 54 public ScreenManager, |
| 55 public EulaScreen::Delegate, | 55 public EulaScreen::Delegate, |
| 56 public ControllerPairingScreen::Delegate, | 56 public ControllerPairingScreen::Delegate, |
| 57 public HostPairingScreen::Delegate, | 57 public HostPairingScreen::Delegate, |
| 58 public NetworkScreen::Delegate, | 58 public NetworkScreen::Delegate, |
| 59 public HIDDetectionScreen::Delegate { | 59 public HIDDetectionScreen::Delegate { |
| 60 public: | 60 public: |
| 61 // Observes screen changes. | |
| 62 class Observer { | |
| 63 public: | |
| 64 // Called before a screen change happens. | |
| 65 virtual void OnScreenChanged(BaseScreen* next_screen) = 0; | |
| 66 | |
| 67 // Called after the browser session has started. | |
| 68 virtual void OnSessionStart() = 0; | |
| 69 }; | |
| 70 | |
| 71 WizardController(LoginDisplayHost* host, OobeUI* oobe_ui); | 61 WizardController(LoginDisplayHost* host, OobeUI* oobe_ui); |
| 72 ~WizardController() override; | 62 ~WizardController() override; |
| 73 | 63 |
| 74 // Returns the default wizard controller if it has been created. | 64 // Returns the default wizard controller if it has been created. |
| 75 static WizardController* default_controller() { | 65 static WizardController* default_controller() { |
| 76 return default_controller_; | 66 return default_controller_; |
| 77 } | 67 } |
| 78 | 68 |
| 79 // Whether to skip any screens that may normally be shown after login | 69 // Whether to skip any screens that may normally be shown after login |
| 80 // (registration, Terms of Service, user image selection). | 70 // (registration, Terms of Service, user image selection). |
| (...skipping 21 matching lines...) Expand all Loading... |
| 102 // Advances to screen defined by |screen| and shows it. | 92 // Advances to screen defined by |screen| and shows it. |
| 103 void AdvanceToScreen(OobeScreen screen); | 93 void AdvanceToScreen(OobeScreen screen); |
| 104 | 94 |
| 105 // Advances to login screen. Should be used in for testing only. | 95 // Advances to login screen. Should be used in for testing only. |
| 106 void SkipToLoginForTesting(const LoginScreenContext& context); | 96 void SkipToLoginForTesting(const LoginScreenContext& context); |
| 107 | 97 |
| 108 // Should be used for testing only. | 98 // Should be used for testing only. |
| 109 pairing_chromeos::SharkConnectionListener* | 99 pairing_chromeos::SharkConnectionListener* |
| 110 GetSharkConnectionListenerForTesting(); | 100 GetSharkConnectionListenerForTesting(); |
| 111 | 101 |
| 112 // Adds and removes an observer. | |
| 113 void AddObserver(Observer* observer); | |
| 114 void RemoveObserver(Observer* observer); | |
| 115 | |
| 116 // Called right after the browser session has started. | |
| 117 void OnSessionStart(); | |
| 118 | |
| 119 // Skip update, go straight to enrollment after EULA is accepted. | 102 // Skip update, go straight to enrollment after EULA is accepted. |
| 120 void SkipUpdateEnrollAfterEula(); | 103 void SkipUpdateEnrollAfterEula(); |
| 121 | 104 |
| 122 // TODO(antrim) : temporary hack. Should be removed once screen system is | 105 // TODO(antrim) : temporary hack. Should be removed once screen system is |
| 123 // reworked at hackaton. | 106 // reworked at hackaton. |
| 124 void EnableUserImageScreenReturnToPreviousHack(); | 107 void EnableUserImageScreenReturnToPreviousHack(); |
| 125 | 108 |
| 126 // Returns a pointer to the current screen or nullptr if there's no such | 109 // Returns a pointer to the current screen or nullptr if there's no such |
| 127 // screen. | 110 // screen. |
| 128 BaseScreen* current_screen() const { return current_screen_; } | 111 BaseScreen* current_screen() const { return current_screen_; } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 bool retry_auto_enrollment_check_ = false; | 350 bool retry_auto_enrollment_check_ = false; |
| 368 | 351 |
| 369 // Time when the EULA was accepted. Used to measure the duration from the EULA | 352 // Time when the EULA was accepted. Used to measure the duration from the EULA |
| 370 // acceptance until the Sign-In screen is displayed. | 353 // acceptance until the Sign-In screen is displayed. |
| 371 base::Time time_eula_accepted_; | 354 base::Time time_eula_accepted_; |
| 372 | 355 |
| 373 // Time when OOBE was started. Used to measure the total time from boot to | 356 // Time when OOBE was started. Used to measure the total time from boot to |
| 374 // user Sign-In completed. | 357 // user Sign-In completed. |
| 375 base::Time time_oobe_started_; | 358 base::Time time_oobe_started_; |
| 376 | 359 |
| 377 base::ObserverList<Observer> observer_list_; | |
| 378 | |
| 379 // Whether OOBE has yet been marked as completed. | 360 // Whether OOBE has yet been marked as completed. |
| 380 bool oobe_marked_completed_ = false; | 361 bool oobe_marked_completed_ = false; |
| 381 | 362 |
| 382 bool login_screen_started_ = false; | 363 bool login_screen_started_ = false; |
| 383 | 364 |
| 384 // Indicates that once image selection screen finishes we should return to | 365 // Indicates that once image selection screen finishes we should return to |
| 385 // a previous screen instead of proceeding with usual flow. | 366 // a previous screen instead of proceeding with usual flow. |
| 386 bool user_image_screen_return_to_previous_hack_ = false; | 367 bool user_image_screen_return_to_previous_hack_ = false; |
| 387 | 368 |
| 388 // Non-owning pointer to local state used for testing. | 369 // Non-owning pointer to local state used for testing. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 BaseScreen* hid_screen_ = nullptr; | 404 BaseScreen* hid_screen_ = nullptr; |
| 424 | 405 |
| 425 base::WeakPtrFactory<WizardController> weak_factory_; | 406 base::WeakPtrFactory<WizardController> weak_factory_; |
| 426 | 407 |
| 427 DISALLOW_COPY_AND_ASSIGN(WizardController); | 408 DISALLOW_COPY_AND_ASSIGN(WizardController); |
| 428 }; | 409 }; |
| 429 | 410 |
| 430 } // namespace chromeos | 411 } // namespace chromeos |
| 431 | 412 |
| 432 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ | 413 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
| OLD | NEW |