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 <string> | 9 #include <string> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/linked_ptr.h" |
14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
17 #include "base/time/time.h" | 19 #include "base/time/time.h" |
18 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
19 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 21 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
20 #include "chrome/browser/chromeos/login/screens/screen_observer.h" | 22 #include "chrome/browser/chromeos/login/screens/screen_observer.h" |
21 | 23 |
22 class PrefRegistrySimple; | 24 class PrefRegistrySimple; |
23 class PrefService; | 25 class PrefService; |
24 | 26 |
25 namespace base { | 27 namespace base { |
26 class DictionaryValue; | 28 class DictionaryValue; |
27 } | 29 } |
28 | 30 |
29 namespace chromeos { | 31 namespace chromeos { |
30 | 32 |
31 class AutoEnrollmentCheckScreen; | 33 class AutoEnrollmentCheckScreen; |
32 class ControllerPairingScreen; | |
33 class EnrollmentScreen; | 34 class EnrollmentScreen; |
34 class ErrorScreen; | 35 class ErrorScreen; |
35 class EulaScreen; | |
36 struct Geoposition; | 36 struct Geoposition; |
37 class HIDDetectionScreen; | |
38 class HostPairingScreen; | |
39 class KioskAutolaunchScreen; | |
40 class KioskEnableScreen; | |
41 class LoginDisplayHost; | 37 class LoginDisplayHost; |
42 class LoginScreenContext; | 38 class LoginScreenContext; |
43 class NetworkScreen; | 39 class NetworkScreen; |
44 class OobeDisplay; | 40 class OobeDisplay; |
45 class ResetScreen; | |
46 class SimpleGeolocationProvider; | 41 class SimpleGeolocationProvider; |
47 class SupervisedUserCreationScreen; | 42 class SupervisedUserCreationScreen; |
48 class TermsOfServiceScreen; | |
49 class TimeZoneProvider; | 43 class TimeZoneProvider; |
50 struct TimeZoneResponseData; | 44 struct TimeZoneResponseData; |
51 class UpdateScreen; | 45 class UpdateScreen; |
52 class UserImageScreen; | 46 class UserImageScreen; |
53 class WizardScreen; | |
54 class WrongHWIDScreen; | |
55 | 47 |
56 // Class that manages control flow between wizard screens. Wizard controller | 48 // Class that manages control flow between wizard screens. Wizard controller |
57 // interacts with screen controllers to move the user between screens. | 49 // interacts with screen controllers to move the user between screens. |
58 class WizardController : public ScreenObserver { | 50 class WizardController : public ScreenObserver { |
59 public: | 51 public: |
60 // Observes screen changes. | 52 // Observes screen changes. |
61 class Observer { | 53 class Observer { |
62 public: | 54 public: |
63 // Called before a screen change happens. | 55 // Called before a screen change happens. |
64 virtual void OnScreenChanged(WizardScreen* next_screen) = 0; | 56 virtual void OnScreenChanged(WizardScreen* next_screen) = 0; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 void OnSessionStart(); | 115 void OnSessionStart(); |
124 | 116 |
125 // Skip update, go straight to enrollment after EULA is accepted. | 117 // Skip update, go straight to enrollment after EULA is accepted. |
126 void SkipUpdateEnrollAfterEula(); | 118 void SkipUpdateEnrollAfterEula(); |
127 | 119 |
128 // TODO(antrim) : temporary hack. Should be removed once screen system is | 120 // TODO(antrim) : temporary hack. Should be removed once screen system is |
129 // reworked at hackaton. | 121 // reworked at hackaton. |
130 void EnableUserImageScreenReturnToPreviousHack(); | 122 void EnableUserImageScreenReturnToPreviousHack(); |
131 | 123 |
132 // Lazy initializers and getters for screens. | 124 // Lazy initializers and getters for screens. |
| 125 WizardScreen* GetScreen(const std::string& screen_name); |
| 126 WizardScreen* CreateScreen(const std::string& screen_name); |
| 127 |
| 128 // Typed getters for the screens. |
133 NetworkScreen* GetNetworkScreen(); | 129 NetworkScreen* GetNetworkScreen(); |
134 UpdateScreen* GetUpdateScreen(); | 130 UpdateScreen* GetUpdateScreen(); |
135 UserImageScreen* GetUserImageScreen(); | 131 UserImageScreen* GetUserImageScreen(); |
136 EulaScreen* GetEulaScreen(); | |
137 EnrollmentScreen* GetEnrollmentScreen(); | 132 EnrollmentScreen* GetEnrollmentScreen(); |
138 ResetScreen* GetResetScreen(); | |
139 KioskAutolaunchScreen* GetKioskAutolaunchScreen(); | |
140 KioskEnableScreen* GetKioskEnableScreen(); | |
141 TermsOfServiceScreen* GetTermsOfServiceScreen(); | |
142 WrongHWIDScreen* GetWrongHWIDScreen(); | |
143 AutoEnrollmentCheckScreen* GetAutoEnrollmentCheckScreen(); | 133 AutoEnrollmentCheckScreen* GetAutoEnrollmentCheckScreen(); |
144 SupervisedUserCreationScreen* GetSupervisedUserCreationScreen(); | 134 SupervisedUserCreationScreen* GetSupervisedUserCreationScreen(); |
145 HIDDetectionScreen* GetHIDDetectionScreen(); | |
146 ControllerPairingScreen* GetControllerPairingScreen(); | |
147 HostPairingScreen* GetHostPairingScreen(); | |
148 | 135 |
149 // Returns a pointer to the current screen or NULL if there's no such | 136 // Returns a pointer to the current screen or NULL if there's no such |
150 // screen. | 137 // screen. |
151 WizardScreen* current_screen() const { return current_screen_; } | 138 WizardScreen* current_screen() const { return current_screen_; } |
152 | 139 |
153 // Returns true if the current wizard instance has reached the login screen. | 140 // Returns true if the current wizard instance has reached the login screen. |
154 bool login_screen_started() const { return login_screen_started_; } | 141 bool login_screen_started() const { return login_screen_started_; } |
155 | 142 |
156 static const char kNetworkScreenName[]; | 143 static const char kNetworkScreenName[]; |
157 static const char kLoginScreenName[]; | 144 static const char kLoginScreenName[]; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // Returns false if timezone has already been resolved. | 299 // Returns false if timezone has already been resolved. |
313 bool SetOnTimeZoneResolvedForTesting(const base::Closure& callback); | 300 bool SetOnTimeZoneResolvedForTesting(const base::Closure& callback); |
314 | 301 |
315 // Whether to skip any screens that may normally be shown after login | 302 // Whether to skip any screens that may normally be shown after login |
316 // (registration, Terms of Service, user image selection). | 303 // (registration, Terms of Service, user image selection). |
317 static bool skip_post_login_screens_; | 304 static bool skip_post_login_screens_; |
318 | 305 |
319 static bool zero_delay_enabled_; | 306 static bool zero_delay_enabled_; |
320 | 307 |
321 // Screens. | 308 // Screens. |
322 scoped_ptr<NetworkScreen> network_screen_; | 309 |
323 scoped_ptr<UpdateScreen> update_screen_; | 310 typedef std::map<std::string, linked_ptr<WizardScreen> > ScreenMap; |
324 scoped_ptr<UserImageScreen> user_image_screen_; | 311 ScreenMap screens_; |
325 scoped_ptr<EulaScreen> eula_screen_; | |
326 scoped_ptr<ResetScreen> reset_screen_; | |
327 scoped_ptr<KioskAutolaunchScreen> autolaunch_screen_; | |
328 scoped_ptr<KioskEnableScreen> kiosk_enable_screen_; | |
329 scoped_ptr<EnrollmentScreen> enrollment_screen_; | |
330 scoped_ptr<ErrorScreen> error_screen_; | |
331 scoped_ptr<TermsOfServiceScreen> terms_of_service_screen_; | |
332 scoped_ptr<WrongHWIDScreen> wrong_hwid_screen_; | |
333 scoped_ptr<AutoEnrollmentCheckScreen> auto_enrollment_check_screen_; | |
334 scoped_ptr<SupervisedUserCreationScreen> supervised_user_creation_screen_; | |
335 scoped_ptr<HIDDetectionScreen> hid_detection_screen_; | |
336 scoped_ptr<ControllerPairingScreen> controller_pairing_screen_; | |
337 scoped_ptr<HostPairingScreen> host_pairing_screen_; | |
338 | 312 |
339 // Screen that's currently active. | 313 // Screen that's currently active. |
340 WizardScreen* current_screen_; | 314 WizardScreen* current_screen_; |
341 | 315 |
342 // Screen that was active before, or NULL for login screen. | 316 // Screen that was active before, or NULL for login screen. |
343 WizardScreen* previous_screen_; | 317 WizardScreen* previous_screen_; |
344 | 318 |
345 std::string username_; | 319 std::string username_; |
346 std::string password_; | 320 std::string password_; |
347 | 321 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 base::Closure on_timezone_resolved_for_testing_; | 392 base::Closure on_timezone_resolved_for_testing_; |
419 | 393 |
420 base::WeakPtrFactory<WizardController> weak_factory_; | 394 base::WeakPtrFactory<WizardController> weak_factory_; |
421 | 395 |
422 DISALLOW_COPY_AND_ASSIGN(WizardController); | 396 DISALLOW_COPY_AND_ASSIGN(WizardController); |
423 }; | 397 }; |
424 | 398 |
425 } // namespace chromeos | 399 } // namespace chromeos |
426 | 400 |
427 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ | 401 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
OLD | NEW |