OLD | NEW |
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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 const std::string& error_text, | 81 const std::string& error_text, |
82 const std::string& help_link_text, | 82 const std::string& help_link_text, |
83 HelpAppLauncher::HelpTopic help_topic_id) = 0; | 83 HelpAppLauncher::HelpTopic help_topic_id) = 0; |
84 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) = 0; | 84 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) = 0; |
85 virtual void ShowGaiaPasswordChanged(const std::string& username) = 0; | 85 virtual void ShowGaiaPasswordChanged(const std::string& username) = 0; |
86 virtual void ShowSigninUI(const std::string& email) = 0; | 86 virtual void ShowSigninUI(const std::string& email) = 0; |
87 virtual void ShowPasswordChangedDialog(bool show_password_error) = 0; | 87 virtual void ShowPasswordChangedDialog(bool show_password_error) = 0; |
88 // Show sign-in screen for the given credentials. | 88 // Show sign-in screen for the given credentials. |
89 virtual void ShowSigninScreenForCreds(const std::string& username, | 89 virtual void ShowSigninScreenForCreds(const std::string& username, |
90 const std::string& password) = 0; | 90 const std::string& password) = 0; |
| 91 virtual void LoadUsers(const base::ListValue& users_list, |
| 92 bool animated, |
| 93 bool show_guest) = 0; |
| 94 |
91 protected: | 95 protected: |
92 virtual ~LoginDisplayWebUIHandler() {} | 96 virtual ~LoginDisplayWebUIHandler() {} |
93 }; | 97 }; |
94 | 98 |
95 // An interface for SigninScreenHandler to call WebUILoginDisplay. | 99 // An interface for SigninScreenHandler to call WebUILoginDisplay. |
96 class SigninScreenHandlerDelegate { | 100 class SigninScreenHandlerDelegate { |
97 public: | 101 public: |
98 // Cancels current password changed flow. | 102 // Cancels current password changed flow. |
99 virtual void CancelPasswordChangedFlow() = 0; | 103 virtual void CancelPasswordChangedFlow() = 0; |
100 | 104 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Returns users list to be shown. | 163 // Returns users list to be shown. |
160 virtual const UserList& GetUsers() const = 0; | 164 virtual const UserList& GetUsers() const = 0; |
161 | 165 |
162 // Whether login as guest is available. | 166 // Whether login as guest is available. |
163 virtual bool IsShowGuest() const = 0; | 167 virtual bool IsShowGuest() const = 0; |
164 | 168 |
165 // Weather to show the user pods or only GAIA sign in. | 169 // Weather to show the user pods or only GAIA sign in. |
166 // Public sessions are always shown. | 170 // Public sessions are always shown. |
167 virtual bool IsShowUsers() const = 0; | 171 virtual bool IsShowUsers() const = 0; |
168 | 172 |
169 // Whether new user pod is available. | |
170 virtual bool IsShowNewUser() const = 0; | |
171 | |
172 // Returns true if sign in is in progress. | 173 // Returns true if sign in is in progress. |
173 virtual bool IsSigninInProgress() const = 0; | 174 virtual bool IsSigninInProgress() const = 0; |
174 | 175 |
175 // Whether user sign in has completed. | 176 // Whether user sign in has completed. |
176 virtual bool IsUserSigninCompleted() const = 0; | 177 virtual bool IsUserSigninCompleted() const = 0; |
177 | 178 |
178 // Sets the displayed email for the next login attempt. If it succeeds, | 179 // Sets the displayed email for the next login attempt. If it succeeds, |
179 // user's displayed email value will be updated to |email|. | 180 // user's displayed email value will be updated to |email|. |
180 virtual void SetDisplayEmail(const std::string& email) = 0; | 181 virtual void SetDisplayEmail(const std::string& email) = 0; |
181 | 182 |
182 // Signs out if the screen is currently locked. | 183 // Signs out if the screen is currently locked. |
183 virtual void Signout() = 0; | 184 virtual void Signout() = 0; |
184 | 185 |
185 // Login to kiosk mode for app with |app_id|. | 186 // Login to kiosk mode for app with |app_id|. |
186 virtual void LoginAsKioskApp(const std::string& app_id, | 187 virtual void LoginAsKioskApp(const std::string& app_id, |
187 bool diagnostic_mode) = 0; | 188 bool diagnostic_mode) = 0; |
188 | 189 |
| 190 // Request to (re)load user list. |
| 191 virtual void HandleGetUsers() = 0; |
| 192 |
| 193 // Set authentication type (for easier unlocking). |
| 194 virtual void SetAuthType( |
| 195 const std::string& username, |
| 196 ScreenlockBridge::LockHandler::AuthType auth_type) = 0; |
| 197 |
| 198 // Get authentication type (for easier unlocking). |
| 199 virtual ScreenlockBridge::LockHandler::AuthType GetAuthType( |
| 200 const std::string& username) const = 0; |
| 201 |
189 protected: | 202 protected: |
190 virtual ~SigninScreenHandlerDelegate() {} | 203 virtual ~SigninScreenHandlerDelegate() {} |
191 }; | 204 }; |
192 | 205 |
193 // 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 |
194 // and LoginDisplay. | 207 // and LoginDisplay. |
195 class SigninScreenHandler | 208 class SigninScreenHandler |
196 : public BaseScreenHandler, | 209 : public BaseScreenHandler, |
197 public LoginDisplayWebUIHandler, | 210 public LoginDisplayWebUIHandler, |
198 public content::NotificationObserver, | 211 public content::NotificationObserver, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 virtual void ShowError(int login_attempts, | 288 virtual void ShowError(int login_attempts, |
276 const std::string& error_text, | 289 const std::string& error_text, |
277 const std::string& help_link_text, | 290 const std::string& help_link_text, |
278 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; | 291 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; |
279 virtual void ShowGaiaPasswordChanged(const std::string& username) OVERRIDE; | 292 virtual void ShowGaiaPasswordChanged(const std::string& username) OVERRIDE; |
280 virtual void ShowSigninUI(const std::string& email) OVERRIDE; | 293 virtual void ShowSigninUI(const std::string& email) OVERRIDE; |
281 virtual void ShowPasswordChangedDialog(bool show_password_error) OVERRIDE; | 294 virtual void ShowPasswordChangedDialog(bool show_password_error) OVERRIDE; |
282 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) OVERRIDE; | 295 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) OVERRIDE; |
283 virtual void ShowSigninScreenForCreds(const std::string& username, | 296 virtual void ShowSigninScreenForCreds(const std::string& username, |
284 const std::string& password) OVERRIDE; | 297 const std::string& password) OVERRIDE; |
| 298 virtual void LoadUsers(const base::ListValue& users_list, |
| 299 bool animated, |
| 300 bool show_guest) OVERRIDE; |
285 | 301 |
286 // ui::EventHandler implementation: | 302 // ui::EventHandler implementation: |
287 virtual void OnKeyEvent(ui::KeyEvent* key) OVERRIDE; | 303 virtual void OnKeyEvent(ui::KeyEvent* key) OVERRIDE; |
288 | 304 |
289 // content::NotificationObserver implementation: | 305 // content::NotificationObserver implementation: |
290 virtual void Observe(int type, | 306 virtual void Observe(int type, |
291 const content::NotificationSource& source, | 307 const content::NotificationSource& source, |
292 const content::NotificationDetails& details) OVERRIDE; | 308 const content::NotificationDetails& details) OVERRIDE; |
293 | 309 |
294 // ScreenlockBridge::LockHandler implementation: | 310 // ScreenlockBridge::LockHandler implementation: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 void HandleLoginUIStateChanged(const std::string& source, bool new_value); | 379 void HandleLoginUIStateChanged(const std::string& source, bool new_value); |
364 void HandleUnlockOnLoginSuccess(); | 380 void HandleUnlockOnLoginSuccess(); |
365 void HandleLoginScreenUpdate(); | 381 void HandleLoginScreenUpdate(); |
366 void HandleShowLoadingTimeoutError(); | 382 void HandleShowLoadingTimeoutError(); |
367 void HandleUpdateOfflineLogin(bool offline_login_active); | 383 void HandleUpdateOfflineLogin(bool offline_login_active); |
368 void HandleShowLocallyManagedUserCreationScreen(); | 384 void HandleShowLocallyManagedUserCreationScreen(); |
369 void HandleFocusPod(const std::string& user_id); | 385 void HandleFocusPod(const std::string& user_id); |
370 void HandleLaunchKioskApp(const std::string& app_id, bool diagnostic_mode); | 386 void HandleLaunchKioskApp(const std::string& app_id, bool diagnostic_mode); |
371 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); | 387 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); |
372 | 388 |
373 // Fills |user_dict| with information about |user|. | |
374 static void FillUserDictionary( | |
375 User* user, | |
376 bool is_owner, | |
377 bool is_signin_to_add, | |
378 ScreenlockBridge::LockHandler::AuthType auth_type, | |
379 base::DictionaryValue* user_dict); | |
380 | |
381 // Sends user list to account picker. | |
382 void SendUserList(bool animated); | |
383 | |
384 // Kick off cookie / local storage cleanup. | 389 // Kick off cookie / local storage cleanup. |
385 void StartClearingCookies(const base::Closure& on_clear_callback); | 390 void StartClearingCookies(const base::Closure& on_clear_callback); |
386 void OnCookiesCleared(base::Closure on_clear_callback); | 391 void OnCookiesCleared(base::Closure on_clear_callback); |
387 | 392 |
388 // Kick off DNS cache flushing. | 393 // Kick off DNS cache flushing. |
389 void StartClearingDnsCache(); | 394 void StartClearingDnsCache(); |
390 void OnDnsCleared(); | 395 void OnDnsCleared(); |
391 | 396 |
392 // Decides whether an auth extension should be pre-loaded. If it should, | 397 // Decides whether an auth extension should be pre-loaded. If it should, |
393 // pre-loads it. | 398 // pre-loads it. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 // NOTIFICATION_AUTH_CANCELLED. | 527 // NOTIFICATION_AUTH_CANCELLED. |
523 bool has_pending_auth_ui_; | 528 bool has_pending_auth_ui_; |
524 | 529 |
525 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> | 530 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> |
526 auto_enrollment_progress_subscription_; | 531 auto_enrollment_progress_subscription_; |
527 | 532 |
528 bool caps_lock_enabled_; | 533 bool caps_lock_enabled_; |
529 | 534 |
530 base::Closure kiosk_enable_flow_aborted_callback_for_test_; | 535 base::Closure kiosk_enable_flow_aborted_callback_for_test_; |
531 | 536 |
532 // Map of usernames to their current authentication type. If a user is not | |
533 // contained in the map, it is using the default authentication type. | |
534 std::map<std::string, ScreenlockBridge::LockHandler::AuthType> | |
535 user_auth_type_map_; | |
536 | |
537 // Non-owning ptr. | 537 // Non-owning ptr. |
538 // TODO (ygorshenin@): remove this dependency. | 538 // TODO (ygorshenin@): remove this dependency. |
539 GaiaScreenHandler* gaia_screen_handler_; | 539 GaiaScreenHandler* gaia_screen_handler_; |
540 | 540 |
541 // Helper that retrieves the authenticated user's e-mail address. | 541 // Helper that retrieves the authenticated user's e-mail address. |
542 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; | 542 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; |
543 | 543 |
544 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); | 544 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); |
545 }; | 545 }; |
546 | 546 |
547 } // namespace chromeos | 547 } // namespace chromeos |
548 | 548 |
549 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 549 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
OLD | NEW |