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 <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
21 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 21 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 22 #include "chrome/browser/chromeos/login/screen_manager.h" |
22 #include "chrome/browser/chromeos/login/screens/screen_observer.h" | 23 #include "chrome/browser/chromeos/login/screens/screen_observer.h" |
23 | 24 |
24 class PrefRegistrySimple; | 25 class PrefRegistrySimple; |
25 class PrefService; | 26 class PrefService; |
26 | 27 |
27 namespace base { | 28 namespace base { |
28 class DictionaryValue; | 29 class DictionaryValue; |
29 } | 30 } |
30 | 31 |
31 namespace chromeos { | 32 namespace chromeos { |
32 | 33 |
33 class AutoEnrollmentCheckScreen; | 34 class AutoEnrollmentCheckScreen; |
34 class EnrollmentScreen; | 35 class EnrollmentScreen; |
35 class ErrorScreen; | 36 class ErrorScreen; |
36 struct Geoposition; | 37 struct Geoposition; |
37 class LoginDisplayHost; | 38 class LoginDisplayHost; |
38 class LoginScreenContext; | 39 class LoginScreenContext; |
39 class NetworkScreen; | 40 class NetworkScreen; |
40 class OobeDisplay; | 41 class OobeDisplay; |
41 class SimpleGeolocationProvider; | 42 class SimpleGeolocationProvider; |
42 class SupervisedUserCreationScreen; | 43 class SupervisedUserCreationScreen; |
43 class TimeZoneProvider; | 44 class TimeZoneProvider; |
44 struct TimeZoneResponseData; | 45 struct TimeZoneResponseData; |
45 class UpdateScreen; | 46 class UpdateScreen; |
46 class UserImageScreen; | 47 class UserImageScreen; |
47 | 48 |
48 // Class that manages control flow between wizard screens. Wizard controller | 49 // Class that manages control flow between wizard screens. Wizard controller |
49 // interacts with screen controllers to move the user between screens. | 50 // interacts with screen controllers to move the user between screens. |
50 class WizardController : public ScreenObserver { | 51 class WizardController : public ScreenObserver, public ScreenManager { |
51 public: | 52 public: |
52 // Observes screen changes. | 53 // Observes screen changes. |
53 class Observer { | 54 class Observer { |
54 public: | 55 public: |
55 // Called before a screen change happens. | 56 // Called before a screen change happens. |
56 virtual void OnScreenChanged(WizardScreen* next_screen) = 0; | 57 virtual void OnScreenChanged(WizardScreen* next_screen) = 0; |
57 | 58 |
58 // Called after the browser session has started. | 59 // Called after the browser session has started. |
59 virtual void OnSessionStart() = 0; | 60 virtual void OnSessionStart() = 0; |
60 }; | 61 }; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // Called right after the browser session has started. | 115 // Called right after the browser session has started. |
115 void OnSessionStart(); | 116 void OnSessionStart(); |
116 | 117 |
117 // Skip update, go straight to enrollment after EULA is accepted. | 118 // Skip update, go straight to enrollment after EULA is accepted. |
118 void SkipUpdateEnrollAfterEula(); | 119 void SkipUpdateEnrollAfterEula(); |
119 | 120 |
120 // TODO(antrim) : temporary hack. Should be removed once screen system is | 121 // TODO(antrim) : temporary hack. Should be removed once screen system is |
121 // reworked at hackaton. | 122 // reworked at hackaton. |
122 void EnableUserImageScreenReturnToPreviousHack(); | 123 void EnableUserImageScreenReturnToPreviousHack(); |
123 | 124 |
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. | |
129 NetworkScreen* GetNetworkScreen(); | |
130 UpdateScreen* GetUpdateScreen(); | |
131 UserImageScreen* GetUserImageScreen(); | |
132 EnrollmentScreen* GetEnrollmentScreen(); | |
133 AutoEnrollmentCheckScreen* GetAutoEnrollmentCheckScreen(); | |
134 SupervisedUserCreationScreen* GetSupervisedUserCreationScreen(); | |
135 | 125 |
136 // Returns a pointer to the current screen or NULL if there's no such | 126 // Returns a pointer to the current screen or NULL if there's no such |
137 // screen. | 127 // screen. |
138 WizardScreen* current_screen() const { return current_screen_; } | 128 WizardScreen* current_screen() const { return current_screen_; } |
139 | 129 |
140 // Returns true if the current wizard instance has reached the login screen. | 130 // Returns true if the current wizard instance has reached the login screen. |
141 bool login_screen_started() const { return login_screen_started_; } | 131 bool login_screen_started() const { return login_screen_started_; } |
142 | 132 |
| 133 // ScreenManager implementation. |
| 134 virtual WizardScreen* CreateScreen(const std::string& screen_name) OVERRIDE; |
| 135 |
143 static const char kNetworkScreenName[]; | 136 static const char kNetworkScreenName[]; |
144 static const char kLoginScreenName[]; | 137 static const char kLoginScreenName[]; |
145 static const char kUpdateScreenName[]; | 138 static const char kUpdateScreenName[]; |
146 static const char kUserImageScreenName[]; | 139 static const char kUserImageScreenName[]; |
147 static const char kOutOfBoxScreenName[]; | 140 static const char kOutOfBoxScreenName[]; |
148 static const char kTestNoScreenName[]; | 141 static const char kTestNoScreenName[]; |
149 static const char kEulaScreenName[]; | 142 static const char kEulaScreenName[]; |
150 static const char kEnrollmentScreenName[]; | 143 static const char kEnrollmentScreenName[]; |
151 static const char kResetScreenName[]; | 144 static const char kResetScreenName[]; |
152 static const char kKioskEnableScreenName[]; | 145 static const char kKioskEnableScreenName[]; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 294 |
302 // Callback for enrollment auth token. | 295 // Callback for enrollment auth token. |
303 void OnEnrollmentAuthTokenReceived(const std::string& auth_token); | 296 void OnEnrollmentAuthTokenReceived(const std::string& auth_token); |
304 | 297 |
305 // Whether to skip any screens that may normally be shown after login | 298 // Whether to skip any screens that may normally be shown after login |
306 // (registration, Terms of Service, user image selection). | 299 // (registration, Terms of Service, user image selection). |
307 static bool skip_post_login_screens_; | 300 static bool skip_post_login_screens_; |
308 | 301 |
309 static bool zero_delay_enabled_; | 302 static bool zero_delay_enabled_; |
310 | 303 |
311 // Screens. | |
312 | |
313 typedef std::map<std::string, linked_ptr<WizardScreen> > ScreenMap; | |
314 ScreenMap screens_; | |
315 | |
316 // Screen that's currently active. | 304 // Screen that's currently active. |
317 WizardScreen* current_screen_; | 305 WizardScreen* current_screen_; |
318 | 306 |
319 // Screen that was active before, or NULL for login screen. | 307 // Screen that was active before, or NULL for login screen. |
320 WizardScreen* previous_screen_; | 308 WizardScreen* previous_screen_; |
321 | 309 |
322 std::string username_; | 310 std::string username_; |
323 std::string password_; | 311 std::string password_; |
324 std::string auth_token_; | 312 std::string auth_token_; |
325 | 313 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 base::Closure on_timezone_resolved_for_testing_; | 384 base::Closure on_timezone_resolved_for_testing_; |
397 | 385 |
398 base::WeakPtrFactory<WizardController> weak_factory_; | 386 base::WeakPtrFactory<WizardController> weak_factory_; |
399 | 387 |
400 DISALLOW_COPY_AND_ASSIGN(WizardController); | 388 DISALLOW_COPY_AND_ASSIGN(WizardController); |
401 }; | 389 }; |
402 | 390 |
403 } // namespace chromeos | 391 } // namespace chromeos |
404 | 392 |
405 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ | 393 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
OLD | NEW |