Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/oobe_ui.h

Issue 2713513009: cros: Break BaseScreenHandler into two classes. (Closed)
Patch Set: Add comments, fix compile Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "chrome/browser/chromeos/login/oobe_screen.h" 17 #include "chrome/browser/chromeos/login/oobe_screen.h"
18 #include "chrome/browser/chromeos/settings/shutdown_policy_handler.h" 18 #include "chrome/browser/chromeos/settings/shutdown_policy_handler.h"
19 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
19 #include "chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h" 20 #include "chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h"
20 #include "content/public/browser/web_ui_controller.h" 21 #include "content/public/browser/web_ui_controller.h"
21 22
22 namespace ash { 23 namespace ash {
23 class ScreenDimmer; 24 class ScreenDimmer;
24 } 25 }
25 26
26 namespace base { 27 namespace base {
27 class DictionaryValue; 28 class DictionaryValue;
28 } // namespace base 29 } // namespace base
29 30
30 namespace chromeos { 31 namespace chromeos {
31 class AppLaunchSplashScreenView; 32 class AppLaunchSplashScreenView;
32 class ArcKioskSplashScreenView; 33 class ArcKioskSplashScreenView;
33 class ArcTermsOfServiceScreenView; 34 class ArcTermsOfServiceScreenView;
34 class AutoEnrollmentCheckScreenView; 35 class AutoEnrollmentCheckScreenView;
35 class BaseScreenHandler; 36 class BaseScreenHandler;
36 class ControllerPairingScreenView; 37 class ControllerPairingScreenView;
37 class CoreOobeView; 38 class CoreOobeView;
38 class DeviceDisabledScreenView; 39 class DeviceDisabledScreenView;
39 class EnableDebuggingScreenView; 40 class EnableDebuggingScreenView;
40 class EnrollmentScreenView; 41 class EnrollmentScreenView;
41 class EulaView; 42 class EulaView;
42 class ErrorScreen; 43 class ErrorScreen;
43 class ErrorScreenHandler;
44 class GaiaView; 44 class GaiaView;
45 class GaiaScreenHandler;
46 class HIDDetectionView; 45 class HIDDetectionView;
47 class HostPairingScreenView; 46 class HostPairingScreenView;
48 class KioskAppMenuHandler; 47 class KioskAppMenuHandler;
49 class KioskAutolaunchScreenView; 48 class KioskAutolaunchScreenView;
50 class KioskEnableScreenView; 49 class KioskEnableScreenView;
51 class LoginScreenContext; 50 class LoginScreenContext;
52 class NativeWindowDelegate; 51 class NativeWindowDelegate;
53 class NetworkDropdownHandler; 52 class NetworkDropdownHandler;
54 class NetworkStateInformer; 53 class NetworkStateInformer;
55 class NetworkView; 54 class NetworkView;
56 class SigninScreenHandler; 55 class SigninScreenHandler;
57 class SigninScreenHandlerDelegate; 56 class SigninScreenHandlerDelegate;
58 class SupervisedUserCreationScreenHandler; 57 class SupervisedUserCreationScreenHandler;
59 class ResetView; 58 class ResetView;
60 class TermsOfServiceScreenView; 59 class TermsOfServiceScreenView;
61 class UserBoardScreenHandler;
62 class UserBoardView; 60 class UserBoardView;
63 class UserImageView; 61 class UserImageView;
64 class UpdateView; 62 class UpdateView;
65 class WrongHWIDScreenView; 63 class WrongHWIDScreenView;
66 64
67 // A custom WebUI that defines datasource for out-of-box-experience (OOBE) UI: 65 // A custom WebUI that defines datasource for out-of-box-experience (OOBE) UI:
68 // - welcome screen (setup language/keyboard/network). 66 // - welcome screen (setup language/keyboard/network).
69 // - eula screen (CrOS (+ OEM) EULA content/TPM password/crash reporting). 67 // - eula screen (CrOS (+ OEM) EULA content/TPM password/crash reporting).
70 // - update screen. 68 // - update screen.
71 class OobeUI : public content::WebUIController, 69 class OobeUI : public content::WebUIController,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 160
163 NetworkStateInformer* network_state_informer_for_test() const { 161 NetworkStateInformer* network_state_informer_for_test() const {
164 return network_state_informer_.get(); 162 return network_state_informer_.get();
165 } 163 }
166 164
167 // Does ReloadContent() if needed (for example, if material design mode has 165 // Does ReloadContent() if needed (for example, if material design mode has
168 // changed). 166 // changed).
169 void UpdateLocalizedStringsIfNeeded(); 167 void UpdateLocalizedStringsIfNeeded();
170 168
171 private: 169 private:
170 // Lookup a view by its statically registered OobeScreen.
171 template <typename TView>
172 TView* GetView() {
173 OobeScreen expected_screen = TView::kScreenId;
174 for (BaseScreenHandler* handler : screen_handlers_) {
175 if (expected_screen == handler->oobe_screen())
176 return static_cast<TView*>(handler);
177 }
178
179 NOTREACHED() << "Unable to find handler for screen "
180 << GetOobeScreenName(expected_screen);
181 return nullptr;
182 }
183
184 void AddWebUIHandler(std::unique_ptr<BaseWebUIHandler> handler);
172 void AddScreenHandler(std::unique_ptr<BaseScreenHandler> handler); 185 void AddScreenHandler(std::unique_ptr<BaseScreenHandler> handler);
173 186
174 // CoreOobeHandler::Delegate implementation: 187 // CoreOobeHandler::Delegate implementation:
175 void OnCurrentScreenChanged(OobeScreen screen) override; 188 void OnCurrentScreenChanged(OobeScreen screen) override;
176 189
177 // Type of UI. 190 // Type of UI.
178 std::string display_type_; 191 std::string display_type_;
179 192
180 // Reference to NetworkStateInformer that handles changes in network 193 // Reference to NetworkStateInformer that handles changes in network
181 // state. 194 // state.
182 scoped_refptr<NetworkStateInformer> network_state_informer_; 195 scoped_refptr<NetworkStateInformer> network_state_informer_;
183 196
184 // Reference to CoreOobeHandler that handles common requests of Oobe page. 197 // Reference to CoreOobeHandler that handles common requests of Oobe page.
185 CoreOobeHandler* core_handler_ = nullptr; 198 CoreOobeHandler* core_handler_ = nullptr;
186 199
187 // Reference to NetworkDropdownHandler that handles interaction with 200 // Reference to NetworkDropdownHandler that handles interaction with
188 // network dropdown. 201 // network dropdown.
189 NetworkDropdownHandler* network_dropdown_handler_ = nullptr; 202 NetworkDropdownHandler* network_dropdown_handler_ = nullptr;
190 203
191 // Screens views. Note, OobeUI owns them via |handlers_|, not directly here.
192 UpdateView* update_view_ = nullptr;
193 NetworkView* network_view_ = nullptr;
194 EnableDebuggingScreenView* debugging_screen_view_ = nullptr;
195 EulaView* eula_view_ = nullptr;
196 EnrollmentScreenView* enrollment_screen_view_ = nullptr;
197 ResetView* reset_view_ = nullptr;
198 HIDDetectionView* hid_detection_view_ = nullptr;
199 KioskAutolaunchScreenView* autolaunch_screen_view_ = nullptr;
200 KioskEnableScreenView* kiosk_enable_screen_view_ = nullptr;
201 WrongHWIDScreenView* wrong_hwid_screen_view_ = nullptr;
202 AutoEnrollmentCheckScreenView* auto_enrollment_check_screen_view_ = nullptr;
203 SupervisedUserCreationScreenHandler* supervised_user_creation_screen_view_ = 204 SupervisedUserCreationScreenHandler* supervised_user_creation_screen_view_ =
204 nullptr; 205 nullptr;
205 AppLaunchSplashScreenView* app_launch_splash_screen_view_ = nullptr;
206 ArcKioskSplashScreenView* arc_kiosk_splash_screen_view_ = nullptr;
207 ControllerPairingScreenView* controller_pairing_screen_view_ = nullptr;
208 HostPairingScreenView* host_pairing_screen_view_ = nullptr;
209 DeviceDisabledScreenView* device_disabled_screen_view_ = nullptr;
210
211 // Reference to ErrorScreenHandler that handles error screen
212 // requests and forward calls from native code to JS side.
213 ErrorScreenHandler* error_screen_handler_ = nullptr;
214
215 // Reference to GaiaScreenHandler that handles gaia screen requests and
216 // forwards calls from native code to JS side.
217 GaiaScreenHandler* gaia_screen_handler_ = nullptr;
218
219 // Reference to UserBoardScreenHandler, that allows to pick user on device
220 // and attempt authentication.
221 UserBoardScreenHandler* user_board_screen_handler_ = nullptr;
222
223 // Reference to SigninScreenHandler that handles sign-in screen requests and 206 // Reference to SigninScreenHandler that handles sign-in screen requests and
224 // forwards calls from native code to JS side. 207 // forwards calls from native code to JS side.
225 SigninScreenHandler* signin_screen_handler_ = nullptr; 208 SigninScreenHandler* signin_screen_handler_ = nullptr;
226 209
227 TermsOfServiceScreenView* terms_of_service_screen_view_ = nullptr; 210 std::vector<BaseWebUIHandler*> webui_handlers_; // Non-owning pointers.
228 ArcTermsOfServiceScreenView* arc_terms_of_service_screen_view_ = nullptr; 211 std::vector<BaseScreenHandler*> screen_handlers_; // Non-owning pointers.
229 UserImageView* user_image_view_ = nullptr;
230
231 std::vector<BaseScreenHandler*> handlers_; // Non-owning pointers.
232 212
233 KioskAppMenuHandler* kiosk_app_menu_handler_ = 213 KioskAppMenuHandler* kiosk_app_menu_handler_ =
234 nullptr; // Non-owning pointers. 214 nullptr; // Non-owning pointers.
235 215
236 std::unique_ptr<ErrorScreen> error_screen_; 216 std::unique_ptr<ErrorScreen> error_screen_;
237 217
238 // Id of the current oobe/login screen. 218 // Id of the current oobe/login screen.
239 OobeScreen current_screen_ = OobeScreen::SCREEN_UNKNOWN; 219 OobeScreen current_screen_ = OobeScreen::SCREEN_UNKNOWN;
240 220
241 // Id of the previous oobe/login screen. 221 // Id of the previous oobe/login screen.
(...skipping 21 matching lines...) Expand all
263 // Store the deferred JS calls before the screen handler instance is 243 // Store the deferred JS calls before the screen handler instance is
264 // initialized. 244 // initialized.
265 std::unique_ptr<JSCallsContainer> js_calls_container; 245 std::unique_ptr<JSCallsContainer> js_calls_container;
266 246
267 DISALLOW_COPY_AND_ASSIGN(OobeUI); 247 DISALLOW_COPY_AND_ASSIGN(OobeUI);
268 }; 248 };
269 249
270 } // namespace chromeos 250 } // namespace chromeos
271 251
272 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OOBE_UI_H_ 252 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OOBE_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc ('k') | chrome/browser/ui/webui/chromeos/login/oobe_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698