OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_WEBUI_CHROMEOS_LOGIN_OOBE_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OOBE_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OOBE_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OOBE_UI_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/observer_list.h" |
14 #include "chrome/browser/chromeos/login/oobe_display.h" | 15 #include "chrome/browser/chromeos/login/oobe_display.h" |
15 #include "chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h" | 16 #include "chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h" |
16 #include "content/public/browser/web_ui_controller.h" | 17 #include "content/public/browser/web_ui_controller.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 class DictionaryValue; | 20 class DictionaryValue; |
20 } // namespace base | 21 } // namespace base |
21 | 22 |
22 namespace chromeos { | 23 namespace chromeos { |
23 class AppLaunchSplashScreenActor; | 24 class AppLaunchSplashScreenActor; |
(...skipping 10 matching lines...) Expand all Loading... |
34 class UpdateScreenHandler; | 35 class UpdateScreenHandler; |
35 | 36 |
36 // A custom WebUI that defines datasource for out-of-box-experience (OOBE) UI: | 37 // A custom WebUI that defines datasource for out-of-box-experience (OOBE) UI: |
37 // - welcome screen (setup language/keyboard/network). | 38 // - welcome screen (setup language/keyboard/network). |
38 // - eula screen (CrOS (+ OEM) EULA content/TPM password/crash reporting). | 39 // - eula screen (CrOS (+ OEM) EULA content/TPM password/crash reporting). |
39 // - update screen. | 40 // - update screen. |
40 class OobeUI : public OobeDisplay, | 41 class OobeUI : public OobeDisplay, |
41 public content::WebUIController, | 42 public content::WebUIController, |
42 public CoreOobeHandler::Delegate { | 43 public CoreOobeHandler::Delegate { |
43 public: | 44 public: |
| 45 class Observer { |
| 46 public: |
| 47 virtual ~Observer() {} |
| 48 virtual void OnCurrentScreenChanged( |
| 49 Screen current_screen, Screen new_screen) = 0; |
| 50 }; |
| 51 |
44 // JS oobe/login screens names. | 52 // JS oobe/login screens names. |
45 static const char kScreenOobeNetwork[]; | 53 static const char kScreenOobeNetwork[]; |
46 static const char kScreenOobeEula[]; | 54 static const char kScreenOobeEula[]; |
47 static const char kScreenOobeUpdate[]; | 55 static const char kScreenOobeUpdate[]; |
48 static const char kScreenOobeEnrollment[]; | 56 static const char kScreenOobeEnrollment[]; |
49 static const char kScreenGaiaSignin[]; | 57 static const char kScreenGaiaSignin[]; |
50 static const char kScreenAccountPicker[]; | 58 static const char kScreenAccountPicker[]; |
51 static const char kScreenKioskAutolaunch[]; | 59 static const char kScreenKioskAutolaunch[]; |
52 static const char kScreenKioskEnable[]; | 60 static const char kScreenKioskEnable[]; |
53 static const char kScreenErrorMessage[]; | 61 static const char kScreenErrorMessage[]; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // Shows the signin screen. | 109 // Shows the signin screen. |
102 void ShowSigninScreen(SigninScreenHandlerDelegate* delegate, | 110 void ShowSigninScreen(SigninScreenHandlerDelegate* delegate, |
103 NativeWindowDelegate* native_window_delegate); | 111 NativeWindowDelegate* native_window_delegate); |
104 | 112 |
105 // Shows the kiosk splash screen. | 113 // Shows the kiosk splash screen. |
106 void ShowAppLaunchSplashScreen(); | 114 void ShowAppLaunchSplashScreen(); |
107 | 115 |
108 // Resets the delegate set in ShowSigninScreen. | 116 // Resets the delegate set in ShowSigninScreen. |
109 void ResetSigninScreenHandlerDelegate(); | 117 void ResetSigninScreenHandlerDelegate(); |
110 | 118 |
| 119 // Add and remove observers for screen change events. |
| 120 void AddObserver(Observer* observer); |
| 121 void RemoveObserver(Observer* observer); |
| 122 |
111 Screen current_screen() const { return current_screen_; } | 123 Screen current_screen() const { return current_screen_; } |
112 | 124 |
113 const std::string& GetScreenName(Screen screen) const; | 125 const std::string& GetScreenName(Screen screen) const; |
114 | 126 |
115 private: | 127 private: |
116 // Initializes |screen_ids_| and |screen_names_| structures. | 128 // Initializes |screen_ids_| and |screen_names_| structures. |
117 void InitializeScreenMaps(); | 129 void InitializeScreenMaps(); |
118 | 130 |
119 void AddScreenHandler(BaseScreenHandler* handler); | 131 void AddScreenHandler(BaseScreenHandler* handler); |
120 | 132 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Maps screen ids to JS screen names. | 184 // Maps screen ids to JS screen names. |
173 std::vector<std::string> screen_names_; | 185 std::vector<std::string> screen_names_; |
174 | 186 |
175 // Flag that indicates whether JS part is fully loaded and ready to accept | 187 // Flag that indicates whether JS part is fully loaded and ready to accept |
176 // calls. | 188 // calls. |
177 bool ready_; | 189 bool ready_; |
178 | 190 |
179 // Callbacks to notify when JS part is fully loaded and ready to accept calls. | 191 // Callbacks to notify when JS part is fully loaded and ready to accept calls. |
180 std::vector<base::Closure> ready_callbacks_; | 192 std::vector<base::Closure> ready_callbacks_; |
181 | 193 |
| 194 // List of registered observers. |
| 195 ObserverList<Observer> observer_list_; |
| 196 |
182 DISALLOW_COPY_AND_ASSIGN(OobeUI); | 197 DISALLOW_COPY_AND_ASSIGN(OobeUI); |
183 }; | 198 }; |
184 | 199 |
185 } // namespace chromeos | 200 } // namespace chromeos |
186 | 201 |
187 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OOBE_UI_H_ | 202 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OOBE_UI_H_ |
OLD | NEW |