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

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

Issue 296823009: ChromeOS login webui refactoring: split user selection/gaia login screens. (Closed) Base URL: http://git.chromium.org/chromium/src.git@refactoring-1
Patch Set: Created 6 years, 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_SIGNIN_SCREEN_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 class LoginDisplayWebUIHandler { 69 class LoginDisplayWebUIHandler {
70 public: 70 public:
71 virtual void ClearAndEnablePassword() = 0; 71 virtual void ClearAndEnablePassword() = 0;
72 virtual void ClearUserPodPassword() = 0; 72 virtual void ClearUserPodPassword() = 0;
73 virtual void OnUserRemoved(const std::string& username) = 0; 73 virtual void OnUserRemoved(const std::string& username) = 0;
74 virtual void OnUserImageChanged(const User& user) = 0; 74 virtual void OnUserImageChanged(const User& user) = 0;
75 virtual void OnPreferencesChanged() = 0; 75 virtual void OnPreferencesChanged() = 0;
76 virtual void ResetSigninScreenHandlerDelegate() = 0; 76 virtual void ResetSigninScreenHandlerDelegate() = 0;
77 virtual void ShowBannerMessage(const std::string& message) = 0; 77 virtual void ShowBannerMessage(const std::string& message) = 0;
78 virtual void ShowUserPodButton(const std::string& username, 78 virtual void ShowUserPodButton(const std::string& username,
79 const std::string& iconURL, 79 const std::string& iconURL) = 0;
80 const base::Closure& click_callback) = 0; 80 virtual void ShowEasyUnlockBubble() = 0;
81 virtual void HideUserPodButton(const std::string& username) = 0; 81 virtual void HideUserPodButton(const std::string& username) = 0;
82 virtual void SetAuthType(const std::string& username, 82 virtual void SetAuthType(const std::string& username,
83 LoginDisplay::AuthType auth_type, 83 LoginDisplay::AuthType auth_type,
84 const std::string& initial_value) = 0; 84 const std::string& initial_value) = 0;
85 virtual LoginDisplay::AuthType GetAuthType(const std::string& username)
86 const = 0;
87 virtual void ShowError(int login_attempts, 85 virtual void ShowError(int login_attempts,
88 const std::string& error_text, 86 const std::string& error_text,
89 const std::string& help_link_text, 87 const std::string& help_link_text,
90 HelpAppLauncher::HelpTopic help_topic_id) = 0; 88 HelpAppLauncher::HelpTopic help_topic_id) = 0;
91 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) = 0; 89 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) = 0;
92 virtual void ShowGaiaPasswordChanged(const std::string& username) = 0; 90 virtual void ShowGaiaPasswordChanged(const std::string& username) = 0;
93 virtual void ShowSigninUI(const std::string& email) = 0; 91 virtual void ShowSigninUI(const std::string& email) = 0;
94 virtual void ShowControlBar(bool show) = 0; 92 virtual void ShowControlBar(bool show) = 0;
95 virtual void ShowPasswordChangedDialog(bool show_password_error) = 0; 93 virtual void ShowPasswordChangedDialog(bool show_password_error) = 0;
96 // Show sign-in screen for the given credentials. 94 // Show sign-in screen for the given credentials.
97 virtual void ShowSigninScreenForCreds(const std::string& username, 95 virtual void ShowSigninScreenForCreds(const std::string& username,
98 const std::string& password) = 0; 96 const std::string& password) = 0;
97 virtual void LoadUsers(const base::ListValue& users_list,
98 bool animated,
99 bool show_guest) = 0;
100
99 protected: 101 protected:
100 virtual ~LoginDisplayWebUIHandler() {} 102 virtual ~LoginDisplayWebUIHandler() {}
101 }; 103 };
102 104
103 // An interface for SigninScreenHandler to call WebUILoginDisplay. 105 // An interface for SigninScreenHandler to call WebUILoginDisplay.
104 class SigninScreenHandlerDelegate { 106 class SigninScreenHandlerDelegate {
105 public: 107 public:
106 // Cancels current password changed flow. 108 // Cancels current password changed flow.
107 virtual void CancelPasswordChangedFlow() = 0; 109 virtual void CancelPasswordChangedFlow() = 0;
108 110
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Returns users list to be shown. 169 // Returns users list to be shown.
168 virtual const UserList& GetUsers() const = 0; 170 virtual const UserList& GetUsers() const = 0;
169 171
170 // Whether login as guest is available. 172 // Whether login as guest is available.
171 virtual bool IsShowGuest() const = 0; 173 virtual bool IsShowGuest() const = 0;
172 174
173 // Weather to show the user pods or only GAIA sign in. 175 // Weather to show the user pods or only GAIA sign in.
174 // Public sessions are always shown. 176 // Public sessions are always shown.
175 virtual bool IsShowUsers() const = 0; 177 virtual bool IsShowUsers() const = 0;
176 178
177 // Whether new user pod is available.
178 virtual bool IsShowNewUser() const = 0;
179
180 // Returns true if sign in is in progress. 179 // Returns true if sign in is in progress.
181 virtual bool IsSigninInProgress() const = 0; 180 virtual bool IsSigninInProgress() const = 0;
182 181
183 // Whether user sign in has completed. 182 // Whether user sign in has completed.
184 virtual bool IsUserSigninCompleted() const = 0; 183 virtual bool IsUserSigninCompleted() const = 0;
185 184
186 // Sets the displayed email for the next login attempt. If it succeeds, 185 // Sets the displayed email for the next login attempt. If it succeeds,
187 // user's displayed email value will be updated to |email|. 186 // user's displayed email value will be updated to |email|.
188 virtual void SetDisplayEmail(const std::string& email) = 0; 187 virtual void SetDisplayEmail(const std::string& email) = 0;
189 188
190 // Signs out if the screen is currently locked. 189 // Signs out if the screen is currently locked.
191 virtual void Signout() = 0; 190 virtual void Signout() = 0;
192 191
193 // Login to kiosk mode for app with |app_id|. 192 // Login to kiosk mode for app with |app_id|.
194 virtual void LoginAsKioskApp(const std::string& app_id, 193 virtual void LoginAsKioskApp(const std::string& app_id,
195 bool diagnostic_mode) = 0; 194 bool diagnostic_mode) = 0;
196 195
196 // User have clicked the custom unlock button.
197 virtual void HandleCustomButtonClicked(const std::string& user_id) = 0;
198
199 // Request to (re)load user list.
200 virtual void HandleGetUsers() = 0;
201
197 protected: 202 protected:
198 virtual ~SigninScreenHandlerDelegate() {} 203 virtual ~SigninScreenHandlerDelegate() {}
199 }; 204 };
200 205
201 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay 206 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay
202 // and LoginDisplay. 207 // and LoginDisplay.
203 class SigninScreenHandler 208 class SigninScreenHandler
204 : public BaseScreenHandler, 209 : public BaseScreenHandler,
205 public LoginDisplayWebUIHandler, 210 public LoginDisplayWebUIHandler,
206 public content::NotificationObserver, 211 public content::NotificationObserver,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 278
274 // LoginDisplayWebUIHandler implementation: 279 // LoginDisplayWebUIHandler implementation:
275 virtual void ClearAndEnablePassword() OVERRIDE; 280 virtual void ClearAndEnablePassword() OVERRIDE;
276 virtual void ClearUserPodPassword() OVERRIDE; 281 virtual void ClearUserPodPassword() OVERRIDE;
277 virtual void OnUserRemoved(const std::string& username) OVERRIDE; 282 virtual void OnUserRemoved(const std::string& username) OVERRIDE;
278 virtual void OnUserImageChanged(const User& user) OVERRIDE; 283 virtual void OnUserImageChanged(const User& user) OVERRIDE;
279 virtual void OnPreferencesChanged() OVERRIDE; 284 virtual void OnPreferencesChanged() OVERRIDE;
280 virtual void ResetSigninScreenHandlerDelegate() OVERRIDE; 285 virtual void ResetSigninScreenHandlerDelegate() OVERRIDE;
281 virtual void ShowBannerMessage(const std::string& message) OVERRIDE; 286 virtual void ShowBannerMessage(const std::string& message) OVERRIDE;
282 virtual void ShowUserPodButton(const std::string& username, 287 virtual void ShowUserPodButton(const std::string& username,
283 const std::string& iconURL, 288 const std::string& iconURL) OVERRIDE;
284 const base::Closure& click_callback) OVERRIDE; 289 virtual void ShowEasyUnlockBubble() OVERRIDE;
285 virtual void HideUserPodButton(const std::string& username) OVERRIDE; 290 virtual void HideUserPodButton(const std::string& username) OVERRIDE;
286 virtual void SetAuthType(const std::string& username, 291 virtual void SetAuthType(const std::string& username,
287 LoginDisplay::AuthType auth_type, 292 LoginDisplay::AuthType auth_type,
288 const std::string& initial_value) OVERRIDE; 293 const std::string& initial_value) OVERRIDE;
289 virtual LoginDisplay::AuthType GetAuthType(const std::string& username)
290 const OVERRIDE;
291 virtual void ShowError(int login_attempts, 294 virtual void ShowError(int login_attempts,
292 const std::string& error_text, 295 const std::string& error_text,
293 const std::string& help_link_text, 296 const std::string& help_link_text,
294 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; 297 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE;
295 virtual void ShowGaiaPasswordChanged(const std::string& username) OVERRIDE; 298 virtual void ShowGaiaPasswordChanged(const std::string& username) OVERRIDE;
296 virtual void ShowSigninUI(const std::string& email) OVERRIDE; 299 virtual void ShowSigninUI(const std::string& email) OVERRIDE;
297 virtual void ShowControlBar(bool show) OVERRIDE; 300 virtual void ShowControlBar(bool show) OVERRIDE;
298 virtual void ShowPasswordChangedDialog(bool show_password_error) OVERRIDE; 301 virtual void ShowPasswordChangedDialog(bool show_password_error) OVERRIDE;
299 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) OVERRIDE; 302 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) OVERRIDE;
300 virtual void ShowSigninScreenForCreds(const std::string& username, 303 virtual void ShowSigninScreenForCreds(const std::string& username,
301 const std::string& password) OVERRIDE; 304 const std::string& password) OVERRIDE;
305 virtual void LoadUsers(const base::ListValue& users_list,
306 bool animated,
307 bool show_guest) OVERRIDE;
302 308
303 // ui::EventHandler implementation: 309 // ui::EventHandler implementation:
304 virtual void OnKeyEvent(ui::KeyEvent* key) OVERRIDE; 310 virtual void OnKeyEvent(ui::KeyEvent* key) OVERRIDE;
305 311
306 // content::NotificationObserver implementation: 312 // content::NotificationObserver implementation:
307 virtual void Observe(int type, 313 virtual void Observe(int type,
308 const content::NotificationSource& source, 314 const content::NotificationSource& source,
309 const content::NotificationDetails& details) OVERRIDE; 315 const content::NotificationDetails& details) OVERRIDE;
310 316
311 // Shows signin screen after dns cache and cookie cleanup operations finish. 317 // Shows signin screen after dns cache and cookie cleanup operations finish.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 void HandleCustomButtonClicked(const std::string& username); 380 void HandleCustomButtonClicked(const std::string& username);
375 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); 381 void HandleRetrieveAuthenticatedUserEmail(double attempt_token);
376 382
377 // Fills |user_dict| with information about |user|. 383 // Fills |user_dict| with information about |user|.
378 static void FillUserDictionary(User* user, 384 static void FillUserDictionary(User* user,
379 bool is_owner, 385 bool is_owner,
380 bool is_signin_to_add, 386 bool is_signin_to_add,
381 LoginDisplay::AuthType auth_type, 387 LoginDisplay::AuthType auth_type,
382 base::DictionaryValue* user_dict); 388 base::DictionaryValue* user_dict);
383 389
384 // Sends user list to account picker.
385 void SendUserList(bool animated);
386 390
387 // Kick off cookie / local storage cleanup. 391 // Kick off cookie / local storage cleanup.
388 void StartClearingCookies(const base::Closure& on_clear_callback); 392 void StartClearingCookies(const base::Closure& on_clear_callback);
389 void OnCookiesCleared(base::Closure on_clear_callback); 393 void OnCookiesCleared(base::Closure on_clear_callback);
390 394
391 // Kick off DNS cache flushing. 395 // Kick off DNS cache flushing.
392 void StartClearingDnsCache(); 396 void StartClearingDnsCache();
393 void OnDnsCleared(); 397 void OnDnsCleared();
394 398
395 // Decides whether an auth extension should be pre-loaded. If it should, 399 // Decides whether an auth extension should be pre-loaded. If it should,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 528
525 scoped_ptr<CrosSettings::ObserverSubscription> allow_new_user_subscription_; 529 scoped_ptr<CrosSettings::ObserverSubscription> allow_new_user_subscription_;
526 scoped_ptr<CrosSettings::ObserverSubscription> allow_guest_subscription_; 530 scoped_ptr<CrosSettings::ObserverSubscription> allow_guest_subscription_;
527 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> 531 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription>
528 auto_enrollment_progress_subscription_; 532 auto_enrollment_progress_subscription_;
529 533
530 bool caps_lock_enabled_; 534 bool caps_lock_enabled_;
531 535
532 base::Closure kiosk_enable_flow_aborted_callback_for_test_; 536 base::Closure kiosk_enable_flow_aborted_callback_for_test_;
533 537
534 // Map of callbacks run when the custom button on a user pod is clicked.
535 std::map<std::string, base::Closure> user_pod_button_callback_map_;
536
537 // Map of usernames to their current authentication type. If a user is not
538 // contained in the map, it is using the default authentication type.
539 std::map<std::string, LoginDisplay::AuthType> user_auth_type_map_;
540 538
541 // Non-owning ptr. 539 // Non-owning ptr.
542 // TODO (ygorshenin@): remove this dependency. 540 // TODO (ygorshenin@): remove this dependency.
543 GaiaScreenHandler* gaia_screen_handler_; 541 GaiaScreenHandler* gaia_screen_handler_;
544 542
545 // Helper that retrieves the authenticated user's e-mail address. 543 // Helper that retrieves the authenticated user's e-mail address.
546 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; 544 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_;
547 545
548 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); 546 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler);
549 }; 547 };
550 548
551 } // namespace chromeos 549 } // namespace chromeos
552 550
553 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ 551 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698