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

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

Issue 289013002: cros: Clean up screenlockPrivate plumbing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 | Annotate | Revision Log
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 <map>
8 #include <set> 9 #include <set>
9 #include <string> 10 #include <string>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/containers/hash_tables.h" 15 #include "base/containers/hash_tables.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
18 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h" 19 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h"
19 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" 20 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h"
20 #include "chrome/browser/chromeos/login/ui/login_display.h" 21 #include "chrome/browser/chromeos/login/ui/login_display.h"
21 #include "chrome/browser/chromeos/login/users/user_manager.h" 22 #include "chrome/browser/chromeos/login/users/user_manager.h"
22 #include "chrome/browser/chromeos/net/network_portal_detector.h" 23 #include "chrome/browser/chromeos/net/network_portal_detector.h"
23 #include "chrome/browser/chromeos/settings/cros_settings.h" 24 #include "chrome/browser/chromeos/settings/cros_settings.h"
25 #include "chrome/browser/signin/screenlock_bridge.h"
24 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" 26 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
25 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" 27 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h"
26 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" 28 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
27 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 29 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
28 #include "content/public/browser/notification_observer.h" 30 #include "content/public/browser/notification_observer.h"
29 #include "content/public/browser/notification_registrar.h" 31 #include "content/public/browser/notification_registrar.h"
30 #include "content/public/browser/web_ui.h" 32 #include "content/public/browser/web_ui.h"
31 #include "net/base/net_errors.h" 33 #include "net/base/net_errors.h"
32 #include "ui/events/event_handler.h" 34 #include "ui/events/event_handler.h"
33 35
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // An interface for WebUILoginDisplay to call SigninScreenHandler. 70 // An interface for WebUILoginDisplay to call SigninScreenHandler.
69 class LoginDisplayWebUIHandler { 71 class LoginDisplayWebUIHandler {
70 public: 72 public:
71 virtual void ClearAndEnablePassword() = 0; 73 virtual void ClearAndEnablePassword() = 0;
72 virtual void ClearUserPodPassword() = 0; 74 virtual void ClearUserPodPassword() = 0;
73 virtual void OnLoginSuccess(const std::string& username) = 0; 75 virtual void OnLoginSuccess(const std::string& username) = 0;
74 virtual void OnUserRemoved(const std::string& username) = 0; 76 virtual void OnUserRemoved(const std::string& username) = 0;
75 virtual void OnUserImageChanged(const User& user) = 0; 77 virtual void OnUserImageChanged(const User& user) = 0;
76 virtual void OnPreferencesChanged() = 0; 78 virtual void OnPreferencesChanged() = 0;
77 virtual void ResetSigninScreenHandlerDelegate() = 0; 79 virtual void ResetSigninScreenHandlerDelegate() = 0;
78 virtual void ShowBannerMessage(const std::string& message) = 0;
79 virtual void ShowUserPodButton(const std::string& username,
80 const std::string& iconURL,
81 const base::Closure& click_callback) = 0;
82 virtual void HideUserPodButton(const std::string& username) = 0;
83 virtual void SetAuthType(const std::string& username,
84 LoginDisplay::AuthType auth_type,
85 const std::string& initial_value) = 0;
86 virtual LoginDisplay::AuthType GetAuthType(const std::string& username)
87 const = 0;
88 virtual void ShowError(int login_attempts, 80 virtual void ShowError(int login_attempts,
89 const std::string& error_text, 81 const std::string& error_text,
90 const std::string& help_link_text, 82 const std::string& help_link_text,
91 HelpAppLauncher::HelpTopic help_topic_id) = 0; 83 HelpAppLauncher::HelpTopic help_topic_id) = 0;
92 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) = 0; 84 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) = 0;
93 virtual void ShowGaiaPasswordChanged(const std::string& username) = 0; 85 virtual void ShowGaiaPasswordChanged(const std::string& username) = 0;
94 virtual void ShowSigninUI(const std::string& email) = 0; 86 virtual void ShowSigninUI(const std::string& email) = 0;
95 virtual void ShowControlBar(bool show) = 0; 87 virtual void ShowControlBar(bool show) = 0;
96 virtual void ShowPasswordChangedDialog(bool show_password_error) = 0; 88 virtual void ShowPasswordChangedDialog(bool show_password_error) = 0;
97 // Show sign-in screen for the given credentials. 89 // Show sign-in screen for the given credentials.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 virtual ~SigninScreenHandlerDelegate() {} 191 virtual ~SigninScreenHandlerDelegate() {}
200 }; 192 };
201 193
202 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay 194 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay
203 // and LoginDisplay. 195 // and LoginDisplay.
204 class SigninScreenHandler 196 class SigninScreenHandler
205 : public BaseScreenHandler, 197 : public BaseScreenHandler,
206 public LoginDisplayWebUIHandler, 198 public LoginDisplayWebUIHandler,
207 public content::NotificationObserver, 199 public content::NotificationObserver,
208 public ui::EventHandler, 200 public ui::EventHandler,
201 public ScreenlockBridge::LockHandler,
209 public NetworkStateInformer::NetworkStateInformerObserver { 202 public NetworkStateInformer::NetworkStateInformerObserver {
210 public: 203 public:
211 SigninScreenHandler( 204 SigninScreenHandler(
212 const scoped_refptr<NetworkStateInformer>& network_state_informer, 205 const scoped_refptr<NetworkStateInformer>& network_state_informer,
213 ErrorScreenActor* error_screen_actor, 206 ErrorScreenActor* error_screen_actor,
214 CoreOobeActor* core_oobe_actor, 207 CoreOobeActor* core_oobe_actor,
215 GaiaScreenHandler* gaia_screen_handler); 208 GaiaScreenHandler* gaia_screen_handler);
216 virtual ~SigninScreenHandler(); 209 virtual ~SigninScreenHandler();
217 210
218 // Shows the sign in screen. 211 // Shows the sign in screen.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 virtual void RegisterMessages() OVERRIDE; 266 virtual void RegisterMessages() OVERRIDE;
274 267
275 // LoginDisplayWebUIHandler implementation: 268 // LoginDisplayWebUIHandler implementation:
276 virtual void ClearAndEnablePassword() OVERRIDE; 269 virtual void ClearAndEnablePassword() OVERRIDE;
277 virtual void ClearUserPodPassword() OVERRIDE; 270 virtual void ClearUserPodPassword() OVERRIDE;
278 virtual void OnLoginSuccess(const std::string& username) OVERRIDE; 271 virtual void OnLoginSuccess(const std::string& username) OVERRIDE;
279 virtual void OnUserRemoved(const std::string& username) OVERRIDE; 272 virtual void OnUserRemoved(const std::string& username) OVERRIDE;
280 virtual void OnUserImageChanged(const User& user) OVERRIDE; 273 virtual void OnUserImageChanged(const User& user) OVERRIDE;
281 virtual void OnPreferencesChanged() OVERRIDE; 274 virtual void OnPreferencesChanged() OVERRIDE;
282 virtual void ResetSigninScreenHandlerDelegate() OVERRIDE; 275 virtual void ResetSigninScreenHandlerDelegate() OVERRIDE;
283 virtual void ShowBannerMessage(const std::string& message) OVERRIDE;
284 virtual void ShowUserPodButton(const std::string& username,
285 const std::string& iconURL,
286 const base::Closure& click_callback) OVERRIDE;
287 virtual void HideUserPodButton(const std::string& username) OVERRIDE;
288 virtual void SetAuthType(const std::string& username,
289 LoginDisplay::AuthType auth_type,
290 const std::string& initial_value) OVERRIDE;
291 virtual LoginDisplay::AuthType GetAuthType(const std::string& username)
292 const OVERRIDE;
293 virtual void ShowError(int login_attempts, 276 virtual void ShowError(int login_attempts,
294 const std::string& error_text, 277 const std::string& error_text,
295 const std::string& help_link_text, 278 const std::string& help_link_text,
296 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; 279 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE;
297 virtual void ShowGaiaPasswordChanged(const std::string& username) OVERRIDE; 280 virtual void ShowGaiaPasswordChanged(const std::string& username) OVERRIDE;
298 virtual void ShowSigninUI(const std::string& email) OVERRIDE; 281 virtual void ShowSigninUI(const std::string& email) OVERRIDE;
299 virtual void ShowControlBar(bool show) OVERRIDE; 282 virtual void ShowControlBar(bool show) OVERRIDE;
300 virtual void ShowPasswordChangedDialog(bool show_password_error) OVERRIDE; 283 virtual void ShowPasswordChangedDialog(bool show_password_error) OVERRIDE;
301 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) OVERRIDE; 284 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) OVERRIDE;
302 virtual void ShowSigninScreenForCreds(const std::string& username, 285 virtual void ShowSigninScreenForCreds(const std::string& username,
303 const std::string& password) OVERRIDE; 286 const std::string& password) OVERRIDE;
304 287
305 // ui::EventHandler implementation: 288 // ui::EventHandler implementation:
306 virtual void OnKeyEvent(ui::KeyEvent* key) OVERRIDE; 289 virtual void OnKeyEvent(ui::KeyEvent* key) OVERRIDE;
307 290
308 // content::NotificationObserver implementation: 291 // content::NotificationObserver implementation:
309 virtual void Observe(int type, 292 virtual void Observe(int type,
310 const content::NotificationSource& source, 293 const content::NotificationSource& source,
311 const content::NotificationDetails& details) OVERRIDE; 294 const content::NotificationDetails& details) OVERRIDE;
312 295
296 // ScreenlockBridge::LockHandler implementation:
297 virtual void ShowBannerMessage(const std::string& message) OVERRIDE;
298 virtual void ShowUserPodCustomIcon(const std::string& username,
299 const gfx::Image& icon) OVERRIDE;
300 virtual void HideUserPodCustomIcon(const std::string& username) OVERRIDE;
301 virtual void EnableInput() OVERRIDE;
302 virtual void SetAuthType(const std::string& username,
303 ScreenlockBridge::LockHandler::AuthType auth_type,
304 const std::string& initial_value) OVERRIDE;
305 virtual ScreenlockBridge::LockHandler::AuthType GetAuthType(
306 const std::string& username) const OVERRIDE;
307 virtual void Unlock(const std::string& user_email) OVERRIDE;
308
313 // Shows signin screen after dns cache and cookie cleanup operations finish. 309 // Shows signin screen after dns cache and cookie cleanup operations finish.
314 void ShowSigninScreenIfReady(); 310 void ShowSigninScreenIfReady();
315 311
316 // Tells webui to load authentication extension. |force| is used to force the 312 // Tells webui to load authentication extension. |force| is used to force the
317 // extension reloading, if it has already been loaded. |silent_load| is true 313 // extension reloading, if it has already been loaded. |silent_load| is true
318 // for cases when extension should be loaded in the background and it 314 // for cases when extension should be loaded in the background and it
319 // shouldn't grab the focus. |offline| is true when offline version of the 315 // shouldn't grab the focus. |offline| is true when offline version of the
320 // extension should be used. 316 // extension should be used.
321 void LoadAuthExtension(bool force, bool silent_load, bool offline); 317 void LoadAuthExtension(bool force, bool silent_load, bool offline);
322 318
(...skipping 11 matching lines...) Expand all
334 const std::string& auth_code); 330 const std::string& auth_code);
335 void HandleCompleteLogin(const std::string& typed_email, 331 void HandleCompleteLogin(const std::string& typed_email,
336 const std::string& password, 332 const std::string& password,
337 bool using_saml); 333 bool using_saml);
338 void HandleGetUsers(); 334 void HandleGetUsers();
339 void HandleUsingSAMLAPI(); 335 void HandleUsingSAMLAPI();
340 void HandleScrapedPasswordCount(int password_count); 336 void HandleScrapedPasswordCount(int password_count);
341 void HandleScrapedPasswordVerificationFailed(); 337 void HandleScrapedPasswordVerificationFailed();
342 void HandleAuthenticateUser(const std::string& username, 338 void HandleAuthenticateUser(const std::string& username,
343 const std::string& password); 339 const std::string& password);
340 void HandleAttemptUnlock(const std::string& username);
344 void HandleLaunchDemoUser(); 341 void HandleLaunchDemoUser();
345 void HandleLaunchIncognito(); 342 void HandleLaunchIncognito();
346 void HandleLaunchPublicAccount(const std::string& username); 343 void HandleLaunchPublicAccount(const std::string& username);
347 void HandleOfflineLogin(const base::ListValue* args); 344 void HandleOfflineLogin(const base::ListValue* args);
348 void HandleShutdownSystem(); 345 void HandleShutdownSystem();
349 void HandleLoadWallpaper(const std::string& email); 346 void HandleLoadWallpaper(const std::string& email);
350 void HandleRebootSystem(); 347 void HandleRebootSystem();
351 void HandleRemoveUser(const std::string& email); 348 void HandleRemoveUser(const std::string& email);
352 void HandleShowAddUser(const base::ListValue* args); 349 void HandleShowAddUser(const base::ListValue* args);
353 void HandleToggleEnrollmentScreen(); 350 void HandleToggleEnrollmentScreen();
(...skipping 12 matching lines...) Expand all
366 void HandleMigrateUserData(const std::string& password); 363 void HandleMigrateUserData(const std::string& password);
367 void HandleResyncUserData(); 364 void HandleResyncUserData();
368 void HandleLoginUIStateChanged(const std::string& source, bool new_value); 365 void HandleLoginUIStateChanged(const std::string& source, bool new_value);
369 void HandleUnlockOnLoginSuccess(); 366 void HandleUnlockOnLoginSuccess();
370 void HandleLoginScreenUpdate(); 367 void HandleLoginScreenUpdate();
371 void HandleShowLoadingTimeoutError(); 368 void HandleShowLoadingTimeoutError();
372 void HandleUpdateOfflineLogin(bool offline_login_active); 369 void HandleUpdateOfflineLogin(bool offline_login_active);
373 void HandleShowLocallyManagedUserCreationScreen(); 370 void HandleShowLocallyManagedUserCreationScreen();
374 void HandleFocusPod(const std::string& user_id); 371 void HandleFocusPod(const std::string& user_id);
375 void HandleLaunchKioskApp(const std::string& app_id, bool diagnostic_mode); 372 void HandleLaunchKioskApp(const std::string& app_id, bool diagnostic_mode);
376 void HandleCustomButtonClicked(const std::string& username);
377 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); 373 void HandleRetrieveAuthenticatedUserEmail(double attempt_token);
378 374
379 // Fills |user_dict| with information about |user|. 375 // Fills |user_dict| with information about |user|.
380 static void FillUserDictionary(User* user, 376 static void FillUserDictionary(
381 bool is_owner, 377 User* user,
382 bool is_signin_to_add, 378 bool is_owner,
383 LoginDisplay::AuthType auth_type, 379 bool is_signin_to_add,
384 base::DictionaryValue* user_dict); 380 ScreenlockBridge::LockHandler::AuthType auth_type,
381 base::DictionaryValue* user_dict);
385 382
386 // Sends user list to account picker. 383 // Sends user list to account picker.
387 void SendUserList(bool animated); 384 void SendUserList(bool animated);
388 385
389 // Kick off cookie / local storage cleanup. 386 // Kick off cookie / local storage cleanup.
390 void StartClearingCookies(const base::Closure& on_clear_callback); 387 void StartClearingCookies(const base::Closure& on_clear_callback);
391 void OnCookiesCleared(base::Closure on_clear_callback); 388 void OnCookiesCleared(base::Closure on_clear_callback);
392 389
393 // Kick off DNS cache flushing. 390 // Kick off DNS cache flushing.
394 void StartClearingDnsCache(); 391 void StartClearingDnsCache();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 523
527 scoped_ptr<CrosSettings::ObserverSubscription> allow_new_user_subscription_; 524 scoped_ptr<CrosSettings::ObserverSubscription> allow_new_user_subscription_;
528 scoped_ptr<CrosSettings::ObserverSubscription> allow_guest_subscription_; 525 scoped_ptr<CrosSettings::ObserverSubscription> allow_guest_subscription_;
529 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> 526 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription>
530 auto_enrollment_progress_subscription_; 527 auto_enrollment_progress_subscription_;
531 528
532 bool caps_lock_enabled_; 529 bool caps_lock_enabled_;
533 530
534 base::Closure kiosk_enable_flow_aborted_callback_for_test_; 531 base::Closure kiosk_enable_flow_aborted_callback_for_test_;
535 532
536 // Map of callbacks run when the custom button on a user pod is clicked.
537 std::map<std::string, base::Closure> user_pod_button_callback_map_;
538
539 // Map of usernames to their current authentication type. If a user is not 533 // Map of usernames to their current authentication type. If a user is not
540 // contained in the map, it is using the default authentication type. 534 // contained in the map, it is using the default authentication type.
541 std::map<std::string, LoginDisplay::AuthType> user_auth_type_map_; 535 std::map<std::string, ScreenlockBridge::LockHandler::AuthType>
536 user_auth_type_map_;
542 537
543 // Non-owning ptr. 538 // Non-owning ptr.
544 // TODO (ygorshenin@): remove this dependency. 539 // TODO (ygorshenin@): remove this dependency.
545 GaiaScreenHandler* gaia_screen_handler_; 540 GaiaScreenHandler* gaia_screen_handler_;
546 541
547 // Helper that retrieves the authenticated user's e-mail address. 542 // Helper that retrieves the authenticated user's e-mail address.
548 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; 543 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_;
549 544
550 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); 545 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler);
551 }; 546 };
552 547
553 } // namespace chromeos 548 } // namespace chromeos
554 549
555 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ 550 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698