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

Side by Side Diff: chrome/browser/chromeos/login/wizard_controller.h

Issue 2566443005: cros: Replace WizardController string constants with OobeScreen values. (Closed)
Patch Set: Initial upload Created 4 years 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) 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 <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return skip_post_login_screens_; 82 return skip_post_login_screens_;
83 } 83 }
84 84
85 // Sets delays to zero. MUST be used only for tests. 85 // Sets delays to zero. MUST be used only for tests.
86 static void SetZeroDelays(); 86 static void SetZeroDelays();
87 87
88 // If true zero delays have been enabled (for browser tests). 88 // If true zero delays have been enabled (for browser tests).
89 static bool IsZeroDelayEnabled(); 89 static bool IsZeroDelayEnabled();
90 90
91 // Checks whether screen show time should be tracked with UMA. 91 // Checks whether screen show time should be tracked with UMA.
92 static bool IsOOBEStepToTrack(const std::string& screen_id); 92 static bool IsOOBEStepToTrack(OobeScreen screen);
Alexander Alekseev 2016/12/13 03:08:05 Why not "screen_id" ?
jdufault 2016/12/13 22:30:27 Done.
93 93
94 // Skips any screens that may normally be shown after login (registration, 94 // Skips any screens that may normally be shown after login (registration,
95 // Terms of Service, user image selection). 95 // Terms of Service, user image selection).
96 static void SkipPostLoginScreensForTesting(); 96 static void SkipPostLoginScreensForTesting();
97 97
98 // Shows the first screen defined by |first_screen_name| or by default 98 // Shows the first screen defined by |first_screen_name| or by default
99 // if the parameter is empty. 99 // if the parameter is empty.
100 void Init(const std::string& first_screen_name); 100 void Init(OobeScreen first_screen_name);
101 101
102 // Advances to screen defined by |screen_name| and shows it. 102 // Advances to screen defined by |screen| and shows it.
103 void AdvanceToScreen(const std::string& screen_name); 103 void AdvanceToScreen(OobeScreen screen);
104 104
105 // Advances to login screen. Should be used in for testing only. 105 // Advances to login screen. Should be used in for testing only.
106 void SkipToLoginForTesting(const LoginScreenContext& context); 106 void SkipToLoginForTesting(const LoginScreenContext& context);
107 107
108 // Should be used for testing only. 108 // Should be used for testing only.
109 pairing_chromeos::SharkConnectionListener* 109 pairing_chromeos::SharkConnectionListener*
110 GetSharkConnectionListenerForTesting(); 110 GetSharkConnectionListenerForTesting();
111 111
112 // Adds and removes an observer. 112 // Adds and removes an observer.
113 void AddObserver(Observer* observer); 113 void AddObserver(Observer* observer);
(...skipping 10 matching lines...) Expand all
124 void EnableUserImageScreenReturnToPreviousHack(); 124 void EnableUserImageScreenReturnToPreviousHack();
125 125
126 // Returns a pointer to the current screen or nullptr if there's no such 126 // Returns a pointer to the current screen or nullptr if there's no such
127 // screen. 127 // screen.
128 BaseScreen* current_screen() const { return current_screen_; } 128 BaseScreen* current_screen() const { return current_screen_; }
129 129
130 // 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.
131 bool login_screen_started() const { return login_screen_started_; } 131 bool login_screen_started() const { return login_screen_started_; }
132 132
133 // ScreenManager implementation. 133 // ScreenManager implementation.
134 BaseScreen* GetScreen(const std::string& screen_name) override; 134 BaseScreen* GetScreen(OobeScreen screen) override;
135 BaseScreen* CreateScreen(const std::string& screen_name) override; 135 BaseScreen* CreateScreen(OobeScreen screen) override;
136
137 static const char kNetworkScreenName[];
138 static const char kLoginScreenName[];
139 static const char kUpdateScreenName[];
140 static const char kUserImageScreenName[];
141 static const char kOutOfBoxScreenName[];
142 static const char kTestNoScreenName[];
143 static const char kEulaScreenName[];
144 static const char kEnableDebuggingScreenName[];
145 static const char kEnrollmentScreenName[];
146 static const char kResetScreenName[];
147 static const char kKioskEnableScreenName[];
148 static const char kKioskAutolaunchScreenName[];
149 static const char kErrorScreenName[];
150 static const char kTermsOfServiceScreenName[];
151 static const char kArcTermsOfServiceScreenName[];
152 static const char kAutoEnrollmentCheckScreenName[];
153 static const char kWrongHWIDScreenName[];
154 static const char kSupervisedUserCreationScreenName[];
155 static const char kAppLaunchSplashScreenName[];
156 static const char kHIDDetectionScreenName[];
157 static const char kControllerPairingScreenName[];
158 static const char kHostPairingScreenName[];
159 static const char kDeviceDisabledScreenName[];
160 136
161 // Volume percent at which spoken feedback is still audible. 137 // Volume percent at which spoken feedback is still audible.
162 static const int kMinAudibleOutputVolumePercent; 138 static const int kMinAudibleOutputVolumePercent;
163 139
164 private: 140 private:
165 // Show specific screen. 141 // Show specific screen.
166 void ShowNetworkScreen(); 142 void ShowNetworkScreen();
167 void ShowUpdateScreen(); 143 void ShowUpdateScreen();
168 void ShowUserImageScreen(); 144 void ShowUserImageScreen();
169 void ShowEulaScreen(); 145 void ShowEulaScreen();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 // Called when LocalState is initialized. 262 // Called when LocalState is initialized.
287 void OnLocalStateInitialized(bool /* succeeded */); 263 void OnLocalStateInitialized(bool /* succeeded */);
288 264
289 // Returns local state. 265 // Returns local state.
290 PrefService* GetLocalState(); 266 PrefService* GetLocalState();
291 267
292 static void set_local_state_for_testing(PrefService* local_state) { 268 static void set_local_state_for_testing(PrefService* local_state) {
293 local_state_for_testing_ = local_state; 269 local_state_for_testing_ = local_state;
294 } 270 }
295 271
296 std::string first_screen_name() { return first_screen_name_; } 272 OobeScreen first_screen_name() const { return first_screen_name_; }
297 273
298 // Called when network is UP. 274 // Called when network is UP.
299 void StartTimezoneResolve(); 275 void StartTimezoneResolve();
300 276
301 // Creates provider on demand. 277 // Creates provider on demand.
302 TimeZoneProvider* GetTimezoneProvider(); 278 TimeZoneProvider* GetTimezoneProvider();
303 279
304 // TimeZoneRequest::TimeZoneResponseCallback implementation. 280 // TimeZoneRequest::TimeZoneResponseCallback implementation.
305 void OnTimezoneResolved(std::unique_ptr<TimeZoneResponseData> timezone, 281 void OnTimezoneResolved(std::unique_ptr<TimeZoneResponseData> timezone,
306 bool server_error); 282 bool server_error);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 #if defined(GOOGLE_CHROME_BUILD) 331 #if defined(GOOGLE_CHROME_BUILD)
356 bool is_official_build_ = true; 332 bool is_official_build_ = true;
357 #else 333 #else
358 bool is_official_build_ = false; 334 bool is_official_build_ = false;
359 #endif 335 #endif
360 336
361 // True if full OOBE flow should be shown. 337 // True if full OOBE flow should be shown.
362 bool is_out_of_box_ = false; 338 bool is_out_of_box_ = false;
363 339
364 // Value of the screen name that WizardController was started with. 340 // Value of the screen name that WizardController was started with.
365 std::string first_screen_name_; 341 // TODO(jdufault): Rename to first_screen_
342 OobeScreen first_screen_name_;
366 343
367 // OOBE/login display host. 344 // OOBE/login display host.
368 LoginDisplayHost* host_ = nullptr; 345 LoginDisplayHost* host_ = nullptr;
369 346
370 // Default WizardController. 347 // Default WizardController.
371 static WizardController* default_controller_; 348 static WizardController* default_controller_;
372 349
373 base::OneShotTimer smooth_show_timer_; 350 base::OneShotTimer smooth_show_timer_;
374 351
375 OobeUI* const oobe_ui_; 352 OobeUI* const oobe_ui_;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 std::unique_ptr<SimpleGeolocationProvider> geolocation_provider_; 400 std::unique_ptr<SimpleGeolocationProvider> geolocation_provider_;
424 std::unique_ptr<TimeZoneProvider> timezone_provider_; 401 std::unique_ptr<TimeZoneProvider> timezone_provider_;
425 402
426 // Pairing controller for shark devices. 403 // Pairing controller for shark devices.
427 std::unique_ptr<pairing_chromeos::ControllerPairingController> 404 std::unique_ptr<pairing_chromeos::ControllerPairingController>
428 shark_controller_; 405 shark_controller_;
429 406
430 // Pairing controller for remora devices. 407 // Pairing controller for remora devices.
431 std::unique_ptr<pairing_chromeos::HostPairingController> remora_controller_; 408 std::unique_ptr<pairing_chromeos::HostPairingController> remora_controller_;
432 409
433 // Maps screen ids to last time of their shows. 410 // Maps screen names to last time of their shows.
434 base::hash_map<std::string, base::Time> screen_show_times_; 411 base::hash_map<std::string, base::Time> screen_show_times_;
435 412
436 // Tests check result of timezone resolve. 413 // Tests check result of timezone resolve.
437 bool timezone_resolved_ = false; 414 bool timezone_resolved_ = false;
438 base::Closure on_timezone_resolved_for_testing_; 415 base::Closure on_timezone_resolved_for_testing_;
439 416
440 // Listens for incoming connection from a shark controller if a regular (not 417 // Listens for incoming connection from a shark controller if a regular (not
441 // pairing) remora OOBE is active. If connection is established, wizard 418 // pairing) remora OOBE is active. If connection is established, wizard
442 // conroller swithces to a pairing OOBE. 419 // conroller swithces to a pairing OOBE.
443 std::unique_ptr<pairing_chromeos::SharkConnectionListener> 420 std::unique_ptr<pairing_chromeos::SharkConnectionListener>
444 shark_connection_listener_; 421 shark_connection_listener_;
445 422
446 BaseScreen* hid_screen_ = nullptr; 423 BaseScreen* hid_screen_ = nullptr;
447 424
448 base::WeakPtrFactory<WizardController> weak_factory_; 425 base::WeakPtrFactory<WizardController> weak_factory_;
449 426
450 DISALLOW_COPY_AND_ASSIGN(WizardController); 427 DISALLOW_COPY_AND_ASSIGN(WizardController);
451 }; 428 };
452 429
453 } // namespace chromeos 430 } // namespace chromeos
454 431
455 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ 432 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698