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 | |
95 protected: | 91 protected: |
96 virtual ~LoginDisplayWebUIHandler() {} | 92 virtual ~LoginDisplayWebUIHandler() {} |
97 }; | 93 }; |
98 | 94 |
99 // An interface for SigninScreenHandler to call WebUILoginDisplay. | 95 // An interface for SigninScreenHandler to call WebUILoginDisplay. |
100 class SigninScreenHandlerDelegate { | 96 class SigninScreenHandlerDelegate { |
101 public: | 97 public: |
102 // Cancels current password changed flow. | 98 // Cancels current password changed flow. |
103 virtual void CancelPasswordChangedFlow() = 0; | 99 virtual void CancelPasswordChangedFlow() = 0; |
104 | 100 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Returns users list to be shown. | 159 // Returns users list to be shown. |
164 virtual const UserList& GetUsers() const = 0; | 160 virtual const UserList& GetUsers() const = 0; |
165 | 161 |
166 // Whether login as guest is available. | 162 // Whether login as guest is available. |
167 virtual bool IsShowGuest() const = 0; | 163 virtual bool IsShowGuest() const = 0; |
168 | 164 |
169 // Weather to show the user pods or only GAIA sign in. | 165 // Weather to show the user pods or only GAIA sign in. |
170 // Public sessions are always shown. | 166 // Public sessions are always shown. |
171 virtual bool IsShowUsers() const = 0; | 167 virtual bool IsShowUsers() const = 0; |
172 | 168 |
| 169 // Whether new user pod is available. |
| 170 virtual bool IsShowNewUser() const = 0; |
| 171 |
173 // Returns true if sign in is in progress. | 172 // Returns true if sign in is in progress. |
174 virtual bool IsSigninInProgress() const = 0; | 173 virtual bool IsSigninInProgress() const = 0; |
175 | 174 |
176 // Whether user sign in has completed. | 175 // Whether user sign in has completed. |
177 virtual bool IsUserSigninCompleted() const = 0; | 176 virtual bool IsUserSigninCompleted() const = 0; |
178 | 177 |
179 // Sets the displayed email for the next login attempt. If it succeeds, | 178 // Sets the displayed email for the next login attempt. If it succeeds, |
180 // user's displayed email value will be updated to |email|. | 179 // user's displayed email value will be updated to |email|. |
181 virtual void SetDisplayEmail(const std::string& email) = 0; | 180 virtual void SetDisplayEmail(const std::string& email) = 0; |
182 | 181 |
183 // Signs out if the screen is currently locked. | 182 // Signs out if the screen is currently locked. |
184 virtual void Signout() = 0; | 183 virtual void Signout() = 0; |
185 | 184 |
186 // Login to kiosk mode for app with |app_id|. | 185 // Login to kiosk mode for app with |app_id|. |
187 virtual void LoginAsKioskApp(const std::string& app_id, | 186 virtual void LoginAsKioskApp(const std::string& app_id, |
188 bool diagnostic_mode) = 0; | 187 bool diagnostic_mode) = 0; |
189 | 188 |
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 | |
202 protected: | 189 protected: |
203 virtual ~SigninScreenHandlerDelegate() {} | 190 virtual ~SigninScreenHandlerDelegate() {} |
204 }; | 191 }; |
205 | 192 |
206 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay | 193 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay |
207 // and LoginDisplay. | 194 // and LoginDisplay. |
208 class SigninScreenHandler | 195 class SigninScreenHandler |
209 : public BaseScreenHandler, | 196 : public BaseScreenHandler, |
210 public LoginDisplayWebUIHandler, | 197 public LoginDisplayWebUIHandler, |
211 public content::NotificationObserver, | 198 public content::NotificationObserver, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 virtual void ShowError(int login_attempts, | 275 virtual void ShowError(int login_attempts, |
289 const std::string& error_text, | 276 const std::string& error_text, |
290 const std::string& help_link_text, | 277 const std::string& help_link_text, |
291 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; | 278 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; |
292 virtual void ShowGaiaPasswordChanged(const std::string& username) OVERRIDE; | 279 virtual void ShowGaiaPasswordChanged(const std::string& username) OVERRIDE; |
293 virtual void ShowSigninUI(const std::string& email) OVERRIDE; | 280 virtual void ShowSigninUI(const std::string& email) OVERRIDE; |
294 virtual void ShowPasswordChangedDialog(bool show_password_error) OVERRIDE; | 281 virtual void ShowPasswordChangedDialog(bool show_password_error) OVERRIDE; |
295 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) OVERRIDE; | 282 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) OVERRIDE; |
296 virtual void ShowSigninScreenForCreds(const std::string& username, | 283 virtual void ShowSigninScreenForCreds(const std::string& username, |
297 const std::string& password) OVERRIDE; | 284 const std::string& password) OVERRIDE; |
298 virtual void LoadUsers(const base::ListValue& users_list, | |
299 bool animated, | |
300 bool show_guest) OVERRIDE; | |
301 | 285 |
302 // ui::EventHandler implementation: | 286 // ui::EventHandler implementation: |
303 virtual void OnKeyEvent(ui::KeyEvent* key) OVERRIDE; | 287 virtual void OnKeyEvent(ui::KeyEvent* key) OVERRIDE; |
304 | 288 |
305 // content::NotificationObserver implementation: | 289 // content::NotificationObserver implementation: |
306 virtual void Observe(int type, | 290 virtual void Observe(int type, |
307 const content::NotificationSource& source, | 291 const content::NotificationSource& source, |
308 const content::NotificationDetails& details) OVERRIDE; | 292 const content::NotificationDetails& details) OVERRIDE; |
309 | 293 |
310 // ScreenlockBridge::LockHandler implementation: | 294 // ScreenlockBridge::LockHandler implementation: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 void HandleLoginUIStateChanged(const std::string& source, bool new_value); | 363 void HandleLoginUIStateChanged(const std::string& source, bool new_value); |
380 void HandleUnlockOnLoginSuccess(); | 364 void HandleUnlockOnLoginSuccess(); |
381 void HandleLoginScreenUpdate(); | 365 void HandleLoginScreenUpdate(); |
382 void HandleShowLoadingTimeoutError(); | 366 void HandleShowLoadingTimeoutError(); |
383 void HandleUpdateOfflineLogin(bool offline_login_active); | 367 void HandleUpdateOfflineLogin(bool offline_login_active); |
384 void HandleShowLocallyManagedUserCreationScreen(); | 368 void HandleShowLocallyManagedUserCreationScreen(); |
385 void HandleFocusPod(const std::string& user_id); | 369 void HandleFocusPod(const std::string& user_id); |
386 void HandleLaunchKioskApp(const std::string& app_id, bool diagnostic_mode); | 370 void HandleLaunchKioskApp(const std::string& app_id, bool diagnostic_mode); |
387 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); | 371 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); |
388 | 372 |
| 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 |
389 // Kick off cookie / local storage cleanup. | 384 // Kick off cookie / local storage cleanup. |
390 void StartClearingCookies(const base::Closure& on_clear_callback); | 385 void StartClearingCookies(const base::Closure& on_clear_callback); |
391 void OnCookiesCleared(base::Closure on_clear_callback); | 386 void OnCookiesCleared(base::Closure on_clear_callback); |
392 | 387 |
393 // Kick off DNS cache flushing. | 388 // Kick off DNS cache flushing. |
394 void StartClearingDnsCache(); | 389 void StartClearingDnsCache(); |
395 void OnDnsCleared(); | 390 void OnDnsCleared(); |
396 | 391 |
397 // Decides whether an auth extension should be pre-loaded. If it should, | 392 // Decides whether an auth extension should be pre-loaded. If it should, |
398 // pre-loads it. | 393 // pre-loads it. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 // NOTIFICATION_AUTH_CANCELLED. | 522 // NOTIFICATION_AUTH_CANCELLED. |
528 bool has_pending_auth_ui_; | 523 bool has_pending_auth_ui_; |
529 | 524 |
530 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> | 525 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> |
531 auto_enrollment_progress_subscription_; | 526 auto_enrollment_progress_subscription_; |
532 | 527 |
533 bool caps_lock_enabled_; | 528 bool caps_lock_enabled_; |
534 | 529 |
535 base::Closure kiosk_enable_flow_aborted_callback_for_test_; | 530 base::Closure kiosk_enable_flow_aborted_callback_for_test_; |
536 | 531 |
| 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 |