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

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

Issue 304303005: ChromeOS login webui refactoring : Move GAIA-related code to gaia_screen_handler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits, reorder methods Created 6 years, 6 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 <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 26 matching lines...) Expand all
37 namespace base { 37 namespace base {
38 class DictionaryValue; 38 class DictionaryValue;
39 class ListValue; 39 class ListValue;
40 } 40 }
41 41
42 namespace chromeos { 42 namespace chromeos {
43 43
44 class AuthenticatedUserEmailRetriever; 44 class AuthenticatedUserEmailRetriever;
45 class CaptivePortalWindowProxy; 45 class CaptivePortalWindowProxy;
46 class CoreOobeActor; 46 class CoreOobeActor;
47 class GaiaScreenHandler;
47 class LocallyManagedUserCreationScreenHandler; 48 class LocallyManagedUserCreationScreenHandler;
48 class NativeWindowDelegate; 49 class NativeWindowDelegate;
49 class User; 50 class User;
50 class UserContext; 51 class UserContext;
51 52
52 // Helper class to pass initial parameters to the login screen. 53 // Helper class to pass initial parameters to the login screen.
53 class LoginScreenContext { 54 class LoginScreenContext {
54 public: 55 public:
55 LoginScreenContext(); 56 LoginScreenContext();
56 explicit LoginScreenContext(const base::ListValue* args); 57 explicit LoginScreenContext(const base::ListValue* args);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 kiosk_enable_flow_aborted_callback_for_test_ = callback; 246 kiosk_enable_flow_aborted_callback_for_test_ = callback;
246 } 247 }
247 248
248 private: 249 private:
249 enum UIState { 250 enum UIState {
250 UI_STATE_UNKNOWN = 0, 251 UI_STATE_UNKNOWN = 0,
251 UI_STATE_GAIA_SIGNIN, 252 UI_STATE_GAIA_SIGNIN,
252 UI_STATE_ACCOUNT_PICKER, 253 UI_STATE_ACCOUNT_PICKER,
253 }; 254 };
254 255
256 friend class GaiaScreenHandler;
257 friend class LocallyManagedUserCreationScreenHandler;
255 friend class ReportDnsCacheClearedOnUIThread; 258 friend class ReportDnsCacheClearedOnUIThread;
256 friend class LocallyManagedUserCreationScreenHandler;
257 259
258 void ShowImpl(); 260 void ShowImpl();
259 261
260 // Updates current UI of the signin screen according to |ui_state| 262 // Updates current UI of the signin screen according to |ui_state|
261 // argument. Optionally it can pass screen initialization data via 263 // argument. Optionally it can pass screen initialization data via
262 // |params| argument. 264 // |params| argument.
263 void UpdateUIState(UIState ui_state, base::DictionaryValue* params); 265 void UpdateUIState(UIState ui_state, base::DictionaryValue* params);
264 266
265 void UpdateStateInternal(ErrorScreenActor::ErrorReason reason, 267 void UpdateStateInternal(ErrorScreenActor::ErrorReason reason,
266 bool force_update); 268 bool force_update);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 const gfx::Image& icon) OVERRIDE; 315 const gfx::Image& icon) OVERRIDE;
314 virtual void HideUserPodCustomIcon(const std::string& username) OVERRIDE; 316 virtual void HideUserPodCustomIcon(const std::string& username) OVERRIDE;
315 virtual void EnableInput() OVERRIDE; 317 virtual void EnableInput() OVERRIDE;
316 virtual void SetAuthType(const std::string& username, 318 virtual void SetAuthType(const std::string& username,
317 ScreenlockBridge::LockHandler::AuthType auth_type, 319 ScreenlockBridge::LockHandler::AuthType auth_type,
318 const std::string& initial_value) OVERRIDE; 320 const std::string& initial_value) OVERRIDE;
319 virtual ScreenlockBridge::LockHandler::AuthType GetAuthType( 321 virtual ScreenlockBridge::LockHandler::AuthType GetAuthType(
320 const std::string& username) const OVERRIDE; 322 const std::string& username) const OVERRIDE;
321 virtual void Unlock(const std::string& user_email) OVERRIDE; 323 virtual void Unlock(const std::string& user_email) OVERRIDE;
322 324
323 // Shows signin screen after dns cache and cookie cleanup operations finish.
324 void ShowSigninScreenIfReady();
325
326 // Tells webui to load authentication extension. |force| is used to force the
327 // extension reloading, if it has already been loaded. |silent_load| is true
328 // for cases when extension should be loaded in the background and it
329 // shouldn't grab the focus. |offline| is true when offline version of the
330 // extension should be used.
331 void LoadAuthExtension(bool force, bool silent_load, bool offline);
332
333 // Updates authentication extension. Called when device settings that affect 325 // Updates authentication extension. Called when device settings that affect
334 // sign-in (allow BWSI and allow whitelist) are changed. 326 // sign-in (allow BWSI and allow whitelist) are changed.
335 void UserSettingsChanged(); 327 void UserSettingsChanged();
336 void UpdateAddButtonStatus(); 328 void UpdateAddButtonStatus();
337 329
338 // Restore input focus to current user pod. 330 // Restore input focus to current user pod.
339 void RefocusCurrentPod(); 331 void RefocusCurrentPod();
340 332
341 // WebUI message handlers. 333 // WebUI message handlers.
342 void HandleCompleteAuthentication(const std::string& email,
343 const std::string& password,
344 const std::string& auth_code);
345 void HandleCompleteLogin(const std::string& typed_email,
346 const std::string& password,
347 bool using_saml);
348 void HandleGetUsers(); 334 void HandleGetUsers();
349 void HandleUsingSAMLAPI();
350 void HandleScrapedPasswordCount(int password_count);
351 void HandleScrapedPasswordVerificationFailed();
352 void HandleAuthenticateUser(const std::string& username, 335 void HandleAuthenticateUser(const std::string& username,
353 const std::string& password); 336 const std::string& password);
354 void HandleAttemptUnlock(const std::string& username); 337 void HandleAttemptUnlock(const std::string& username);
355 void HandleLaunchDemoUser(); 338 void HandleLaunchDemoUser();
356 void HandleLaunchIncognito(); 339 void HandleLaunchIncognito();
357 void HandleLaunchPublicAccount(const std::string& username); 340 void HandleLaunchPublicAccount(const std::string& username);
358 void HandleOfflineLogin(const base::ListValue* args); 341 void HandleOfflineLogin(const base::ListValue* args);
359 void HandleShutdownSystem(); 342 void HandleShutdownSystem();
360 void HandleLoadWallpaper(const std::string& email); 343 void HandleLoadWallpaper(const std::string& email);
361 void HandleRebootSystem(); 344 void HandleRebootSystem();
362 void HandleRemoveUser(const std::string& email); 345 void HandleRemoveUser(const std::string& email);
363 void HandleShowAddUser(const base::ListValue* args); 346 void HandleShowAddUser(const base::ListValue* args);
364 void HandleToggleEnrollmentScreen(); 347 void HandleToggleEnrollmentScreen();
365 void HandleToggleKioskEnableScreen(); 348 void HandleToggleKioskEnableScreen();
366 void HandleToggleResetScreen(); 349 void HandleToggleResetScreen();
367 void HandleToggleKioskAutolaunchScreen(); 350 void HandleToggleKioskAutolaunchScreen();
368 void HandleCreateAccount(); 351 void HandleCreateAccount();
369 void HandleAccountPickerReady(); 352 void HandleAccountPickerReady();
370 void HandleWallpaperReady(); 353 void HandleWallpaperReady();
371 void HandleLoginWebuiReady();
372 void HandleSignOutUser(); 354 void HandleSignOutUser();
373 void HandleOpenProxySettings(); 355 void HandleOpenProxySettings();
374 void HandleLoginVisible(const std::string& source); 356 void HandleLoginVisible(const std::string& source);
375 void HandleCancelPasswordChangedFlow(); 357 void HandleCancelPasswordChangedFlow();
376 void HandleCancelUserAdding(); 358 void HandleCancelUserAdding();
377 void HandleMigrateUserData(const std::string& password); 359 void HandleMigrateUserData(const std::string& password);
378 void HandleResyncUserData(); 360 void HandleResyncUserData();
379 void HandleLoginUIStateChanged(const std::string& source, bool new_value); 361 void HandleLoginUIStateChanged(const std::string& source, bool new_value);
380 void HandleUnlockOnLoginSuccess(); 362 void HandleUnlockOnLoginSuccess();
381 void HandleLoginScreenUpdate(); 363 void HandleLoginScreenUpdate();
382 void HandleShowLoadingTimeoutError(); 364 void HandleShowLoadingTimeoutError();
383 void HandleUpdateOfflineLogin(bool offline_login_active); 365 void HandleUpdateOfflineLogin(bool offline_login_active);
384 void HandleShowLocallyManagedUserCreationScreen(); 366 void HandleShowLocallyManagedUserCreationScreen();
385 void HandleFocusPod(const std::string& user_id); 367 void HandleFocusPod(const std::string& user_id);
386 void HandleLaunchKioskApp(const std::string& app_id, bool diagnostic_mode); 368 void HandleLaunchKioskApp(const std::string& app_id, bool diagnostic_mode);
387 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); 369 void HandleRetrieveAuthenticatedUserEmail(double attempt_token);
388 370
389 // Kick off cookie / local storage cleanup.
390 void StartClearingCookies(const base::Closure& on_clear_callback);
391 void OnCookiesCleared(base::Closure on_clear_callback);
392
393 // Kick off DNS cache flushing.
394 void StartClearingDnsCache();
395 void OnDnsCleared();
396
397 // Decides whether an auth extension should be pre-loaded. If it should,
398 // pre-loads it.
399 void MaybePreloadAuthExtension();
400 371
401 // Returns true iff 372 // Returns true iff
402 // (i) log in is restricted to some user list, 373 // (i) log in is restricted to some user list,
403 // (ii) all users in the restricted list are present. 374 // (ii) all users in the restricted list are present.
404 bool AllWhitelistedUsersPresent(); 375 bool AllWhitelistedUsersPresent();
405 376
406 // Cancels password changed flow - switches back to login screen. 377 // Cancels password changed flow - switches back to login screen.
407 // Called as a callback after cookies are cleared. 378 // Called as a callback after cookies are cleared.
408 void CancelPasswordChangedFlowInternal(); 379 void CancelPasswordChangedFlowInternal();
409 380
(...skipping 10 matching lines...) Expand all
420 // Returns true if current screen is the error screen over signin 391 // Returns true if current screen is the error screen over signin
421 // screen. 392 // screen.
422 bool IsSigninScreenHiddenByError() const; 393 bool IsSigninScreenHiddenByError() const;
423 394
424 // Returns true if guest signin is allowed. 395 // Returns true if guest signin is allowed.
425 bool IsGuestSigninAllowed() const; 396 bool IsGuestSigninAllowed() const;
426 397
427 // Returns true if offline login is allowed. 398 // Returns true if offline login is allowed.
428 bool IsOfflineLoginAllowed() const; 399 bool IsOfflineLoginAllowed() const;
429 400
430 // Attempts login for test. 401 bool ShouldLoadGaia() const;
431 void SubmitLoginFormForTest();
432 402
433 // Update current input method (namely keyboard layout) to LRU by this user. 403 // Update current input method (namely keyboard layout) to LRU by this user.
434 void SetUserInputMethod(const std::string& username); 404 void SetUserInputMethod(const std::string& username);
435 405
436 // Invoked when auto enrollment check progresses to decide whether to 406 // Invoked when auto enrollment check progresses to decide whether to
437 // continue kiosk enable flow. Kiosk enable flow is resumed when 407 // continue kiosk enable flow. Kiosk enable flow is resumed when
438 // |state| indicates that enrollment is not applicable. 408 // |state| indicates that enrollment is not applicable.
439 void ContinueKioskEnableFlow(policy::AutoEnrollmentState state); 409 void ContinueKioskEnableFlow(policy::AutoEnrollmentState state);
440 410
441 // Shows signin screen for |email|. 411 // Shows signin.
442 void OnShowAddUser(const std::string& email); 412 void OnShowAddUser();
443
444 // Updates the member variable and UMA histogram indicating whether the
445 // principals API was used during SAML login.
446 void SetSAMLPrincipalsAPIUsed(bool api_used);
447 413
448 GaiaScreenHandler::FrameState FrameState() const; 414 GaiaScreenHandler::FrameState FrameState() const;
449 net::Error FrameError() const; 415 net::Error FrameError() const;
450 416
451 // input_method::ImeKeyboard::Observer implementation: 417 // input_method::ImeKeyboard::Observer implementation:
452 virtual void OnCapsLockChanged(bool enabled) OVERRIDE; 418 virtual void OnCapsLockChanged(bool enabled) OVERRIDE;
453 419
454 // Current UI state of the signin screen. 420 // Current UI state of the signin screen.
455 UIState ui_state_; 421 UIState ui_state_;
456 422
457 // A delegate that glues this handler with backend LoginDisplay. 423 // A delegate that glues this handler with backend LoginDisplay.
458 SigninScreenHandlerDelegate* delegate_; 424 SigninScreenHandlerDelegate* delegate_;
459 425
460 // A delegate used to get gfx::NativeWindow. 426 // A delegate used to get gfx::NativeWindow.
461 NativeWindowDelegate* native_window_delegate_; 427 NativeWindowDelegate* native_window_delegate_;
462 428
463 // Whether screen should be shown right after initialization. 429 // Whether screen should be shown right after initialization.
464 bool show_on_init_; 430 bool show_on_init_;
465 431
466 // Keeps whether screen should be shown for OOBE. 432 // Keeps whether screen should be shown for OOBE.
467 bool oobe_ui_; 433 bool oobe_ui_;
468 434
469 // Is focus still stolen from Gaia page?
470 bool focus_stolen_;
471
472 // Has Gaia page silent load been started for the current sign-in attempt?
473 bool gaia_silent_load_;
474
475 // The active network at the moment when Gaia page was preloaded.
476 std::string gaia_silent_load_network_;
477
478 // Is account picker being shown for the first time. 435 // Is account picker being shown for the first time.
479 bool is_account_picker_showing_first_time_; 436 bool is_account_picker_showing_first_time_;
480 437
481 // True if dns cache cleanup is done.
482 bool dns_cleared_;
483
484 // True if DNS cache task is already running.
485 bool dns_clear_task_running_;
486
487 // True if cookie jar cleanup is done.
488 bool cookies_cleared_;
489
490 // Network state informer used to keep signin screen up. 438 // Network state informer used to keep signin screen up.
491 scoped_refptr<NetworkStateInformer> network_state_informer_; 439 scoped_refptr<NetworkStateInformer> network_state_informer_;
492 440
493 // Email to pre-populate with.
494 std::string email_;
495 // Emails of the users, whose passwords have recently been changed.
496 std::set<std::string> password_changed_for_;
497
498 // If the user authenticated via SAML, this indicates whether the principals
499 // API was used.
500 bool using_saml_api_;
501
502 // Test credentials.
503 std::string test_user_;
504 std::string test_pass_;
505 bool test_expects_complete_login_;
506
507 base::WeakPtrFactory<SigninScreenHandler> weak_factory_;
508
509 // Set to true once |LOGIN_WEBUI_VISIBLE| notification is observed. 441 // Set to true once |LOGIN_WEBUI_VISIBLE| notification is observed.
510 bool webui_visible_; 442 bool webui_visible_;
511 bool preferences_changed_delayed_; 443 bool preferences_changed_delayed_;
512 444
513 ErrorScreenActor* error_screen_actor_; 445 ErrorScreenActor* error_screen_actor_;
514 CoreOobeActor* core_oobe_actor_; 446 CoreOobeActor* core_oobe_actor_;
515 447
516 bool is_first_update_state_call_; 448 bool is_first_update_state_call_;
517 bool offline_login_active_; 449 bool offline_login_active_;
518 NetworkStateInformer::State last_network_state_; 450 NetworkStateInformer::State last_network_state_;
(...skipping 15 matching lines...) Expand all
534 466
535 base::Closure kiosk_enable_flow_aborted_callback_for_test_; 467 base::Closure kiosk_enable_flow_aborted_callback_for_test_;
536 468
537 // Non-owning ptr. 469 // Non-owning ptr.
538 // TODO (ygorshenin@): remove this dependency. 470 // TODO (ygorshenin@): remove this dependency.
539 GaiaScreenHandler* gaia_screen_handler_; 471 GaiaScreenHandler* gaia_screen_handler_;
540 472
541 // Helper that retrieves the authenticated user's e-mail address. 473 // Helper that retrieves the authenticated user's e-mail address.
542 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; 474 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_;
543 475
476 base::WeakPtrFactory<SigninScreenHandler> weak_factory_;
477
544 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); 478 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler);
545 }; 479 };
546 480
547 } // namespace chromeos 481 } // namespace chromeos
548 482
549 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ 483 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698