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 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "chrome/browser/chromeos/login/screen_observer.h" | 13 #include "chrome/browser/chromeos/login/screen_observer.h" |
14 #include "chrome/browser/chromeos/login/view_screen.h" | 14 #include "chrome/browser/chromeos/login/view_screen.h" |
15 #include "chrome/browser/chromeos/login/wizard_screen.h" | 15 #include "chrome/browser/chromeos/login/wizard_screen.h" |
| 16 #include "chrome/common/notification_observer.h" |
| 17 #include "chrome/common/notification_registrar.h" |
16 #include "gfx/rect.h" | 18 #include "gfx/rect.h" |
17 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
18 #include "testing/gtest/include/gtest/gtest_prod.h" | 20 #include "testing/gtest/include/gtest/gtest_prod.h" |
19 | 21 |
20 class PrefService; | 22 class PrefService; |
21 class WizardContentsView; | 23 class WizardContentsView; |
22 class WizardScreen; | 24 class WizardScreen; |
23 | 25 |
24 namespace chromeos { | 26 namespace chromeos { |
25 class AccountScreen; | 27 class AccountScreen; |
(...skipping 15 matching lines...) Expand all Loading... |
41 | 43 |
42 namespace views { | 44 namespace views { |
43 class Views; | 45 class Views; |
44 class Widget; | 46 class Widget; |
45 class WidgetGtk; | 47 class WidgetGtk; |
46 } | 48 } |
47 | 49 |
48 // Class that manages control flow between wizard screens. Wizard controller | 50 // Class that manages control flow between wizard screens. Wizard controller |
49 // interacts with screen controllers to move the user between screens. | 51 // interacts with screen controllers to move the user between screens. |
50 class WizardController : public chromeos::ScreenObserver, | 52 class WizardController : public chromeos::ScreenObserver, |
51 public WizardScreenDelegate { | 53 public WizardScreenDelegate, |
| 54 public NotificationObserver { |
52 public: | 55 public: |
53 WizardController(); | 56 WizardController(); |
54 ~WizardController(); | 57 ~WizardController(); |
55 | 58 |
56 // Returns the default wizard controller if it has been created. | 59 // Returns the default wizard controller if it has been created. |
57 static WizardController* default_controller() { | 60 static WizardController* default_controller() { |
58 return default_controller_; | 61 return default_controller_; |
59 } | 62 } |
60 | 63 |
61 // Returns true if EULA has been accepted. | 64 // Returns true if EULA has been accepted. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 static const char kLoginScreenName[]; | 155 static const char kLoginScreenName[]; |
153 static const char kAccountScreenName[]; | 156 static const char kAccountScreenName[]; |
154 static const char kUpdateScreenName[]; | 157 static const char kUpdateScreenName[]; |
155 static const char kUserImageScreenName[]; | 158 static const char kUserImageScreenName[]; |
156 static const char kRegistrationScreenName[]; | 159 static const char kRegistrationScreenName[]; |
157 static const char kOutOfBoxScreenName[]; | 160 static const char kOutOfBoxScreenName[]; |
158 static const char kTestNoScreenName[]; | 161 static const char kTestNoScreenName[]; |
159 static const char kEulaScreenName[]; | 162 static const char kEulaScreenName[]; |
160 static const char kHTMLPageScreenName[]; | 163 static const char kHTMLPageScreenName[]; |
161 | 164 |
| 165 // NotificationObserver implementation: |
| 166 virtual void Observe(NotificationType type, |
| 167 const NotificationSource& source, |
| 168 const NotificationDetails& details); |
| 169 |
162 private: | 170 private: |
163 // Exit handlers: | 171 // Exit handlers: |
164 void OnLoginSignInSelected(); | 172 void OnLoginSignInSelected(); |
165 void OnLoginGuestUser(); | 173 void OnLoginGuestUser(); |
166 void OnLoginCreateAccount(); | 174 void OnLoginCreateAccount(); |
167 void OnNetworkConnected(); | 175 void OnNetworkConnected(); |
168 void OnNetworkOffline(); | 176 void OnNetworkOffline(); |
169 void OnAccountCreateBack(); | 177 void OnAccountCreateBack(); |
170 void OnAccountCreated(); | 178 void OnAccountCreated(); |
171 void OnConnectionFailed(); | 179 void OnConnectionFailed(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 269 |
262 // Default WizardController. | 270 // Default WizardController. |
263 static WizardController* default_controller_; | 271 static WizardController* default_controller_; |
264 | 272 |
265 // Partner startup customizations. | 273 // Partner startup customizations. |
266 scoped_ptr<const chromeos::StartupCustomizationDocument> customization_; | 274 scoped_ptr<const chromeos::StartupCustomizationDocument> customization_; |
267 | 275 |
268 // URL to open on browser launch. | 276 // URL to open on browser launch. |
269 GURL start_url_; | 277 GURL start_url_; |
270 | 278 |
| 279 NotificationRegistrar registrar_; |
| 280 |
271 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowErrorNetwork); | 281 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowErrorNetwork); |
272 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowErrorUpdate); | 282 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowErrorUpdate); |
273 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowEulaDeclined); | 283 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowEulaDeclined); |
274 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, | 284 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, |
275 ControlFlowLanguageOnLogin); | 285 ControlFlowLanguageOnLogin); |
276 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, | 286 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, |
277 ControlFlowLanguageOnNetwork); | 287 ControlFlowLanguageOnNetwork); |
278 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowMain); | 288 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, ControlFlowMain); |
279 FRIEND_TEST_ALL_PREFIXES(WizardControllerTest, SwitchLanguage); | 289 FRIEND_TEST_ALL_PREFIXES(WizardControllerTest, SwitchLanguage); |
280 friend class WizardControllerFlowTest; | 290 friend class WizardControllerFlowTest; |
281 | 291 |
282 DISALLOW_COPY_AND_ASSIGN(WizardController); | 292 DISALLOW_COPY_AND_ASSIGN(WizardController); |
283 }; | 293 }; |
284 | 294 |
285 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ | 295 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
OLD | NEW |