| 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 26 matching lines...) Expand all Loading... |
| 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; | |
| 48 class LocallyManagedUserCreationScreenHandler; | 47 class LocallyManagedUserCreationScreenHandler; |
| 49 class NativeWindowDelegate; | 48 class NativeWindowDelegate; |
| 50 class User; | 49 class User; |
| 51 class UserContext; | 50 class UserContext; |
| 52 | 51 |
| 53 // Helper class to pass initial parameters to the login screen. | 52 // Helper class to pass initial parameters to the login screen. |
| 54 class LoginScreenContext { | 53 class LoginScreenContext { |
| 55 public: | 54 public: |
| 56 LoginScreenContext(); | 55 LoginScreenContext(); |
| 57 explicit LoginScreenContext(const base::ListValue* args); | 56 explicit LoginScreenContext(const base::ListValue* args); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 kiosk_enable_flow_aborted_callback_for_test_ = callback; | 245 kiosk_enable_flow_aborted_callback_for_test_ = callback; |
| 247 } | 246 } |
| 248 | 247 |
| 249 private: | 248 private: |
| 250 enum UIState { | 249 enum UIState { |
| 251 UI_STATE_UNKNOWN = 0, | 250 UI_STATE_UNKNOWN = 0, |
| 252 UI_STATE_GAIA_SIGNIN, | 251 UI_STATE_GAIA_SIGNIN, |
| 253 UI_STATE_ACCOUNT_PICKER, | 252 UI_STATE_ACCOUNT_PICKER, |
| 254 }; | 253 }; |
| 255 | 254 |
| 256 friend class GaiaScreenHandler; | 255 friend class ReportDnsCacheClearedOnUIThread; |
| 257 friend class LocallyManagedUserCreationScreenHandler; | 256 friend class LocallyManagedUserCreationScreenHandler; |
| 258 friend class ReportDnsCacheClearedOnUIThread; | |
| 259 | 257 |
| 260 void ShowImpl(); | 258 void ShowImpl(); |
| 261 | 259 |
| 262 // Updates current UI of the signin screen according to |ui_state| | 260 // Updates current UI of the signin screen according to |ui_state| |
| 263 // argument. Optionally it can pass screen initialization data via | 261 // argument. Optionally it can pass screen initialization data via |
| 264 // |params| argument. | 262 // |params| argument. |
| 265 void UpdateUIState(UIState ui_state, base::DictionaryValue* params); | 263 void UpdateUIState(UIState ui_state, base::DictionaryValue* params); |
| 266 | 264 |
| 267 void UpdateStateInternal(ErrorScreenActor::ErrorReason reason, | 265 void UpdateStateInternal(ErrorScreenActor::ErrorReason reason, |
| 268 bool force_update); | 266 bool force_update); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 const gfx::Image& icon) OVERRIDE; | 313 const gfx::Image& icon) OVERRIDE; |
| 316 virtual void HideUserPodCustomIcon(const std::string& username) OVERRIDE; | 314 virtual void HideUserPodCustomIcon(const std::string& username) OVERRIDE; |
| 317 virtual void EnableInput() OVERRIDE; | 315 virtual void EnableInput() OVERRIDE; |
| 318 virtual void SetAuthType(const std::string& username, | 316 virtual void SetAuthType(const std::string& username, |
| 319 ScreenlockBridge::LockHandler::AuthType auth_type, | 317 ScreenlockBridge::LockHandler::AuthType auth_type, |
| 320 const std::string& initial_value) OVERRIDE; | 318 const std::string& initial_value) OVERRIDE; |
| 321 virtual ScreenlockBridge::LockHandler::AuthType GetAuthType( | 319 virtual ScreenlockBridge::LockHandler::AuthType GetAuthType( |
| 322 const std::string& username) const OVERRIDE; | 320 const std::string& username) const OVERRIDE; |
| 323 virtual void Unlock(const std::string& user_email) OVERRIDE; | 321 virtual void Unlock(const std::string& user_email) OVERRIDE; |
| 324 | 322 |
| 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 |
| 325 // Updates authentication extension. Called when device settings that affect | 333 // Updates authentication extension. Called when device settings that affect |
| 326 // sign-in (allow BWSI and allow whitelist) are changed. | 334 // sign-in (allow BWSI and allow whitelist) are changed. |
| 327 void UserSettingsChanged(); | 335 void UserSettingsChanged(); |
| 328 void UpdateAddButtonStatus(); | 336 void UpdateAddButtonStatus(); |
| 329 | 337 |
| 330 // Restore input focus to current user pod. | 338 // Restore input focus to current user pod. |
| 331 void RefocusCurrentPod(); | 339 void RefocusCurrentPod(); |
| 332 | 340 |
| 333 // WebUI message handlers. | 341 // 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); |
| 334 void HandleGetUsers(); | 348 void HandleGetUsers(); |
| 349 void HandleUsingSAMLAPI(); |
| 350 void HandleScrapedPasswordCount(int password_count); |
| 351 void HandleScrapedPasswordVerificationFailed(); |
| 335 void HandleAuthenticateUser(const std::string& username, | 352 void HandleAuthenticateUser(const std::string& username, |
| 336 const std::string& password); | 353 const std::string& password); |
| 337 void HandleAttemptUnlock(const std::string& username); | 354 void HandleAttemptUnlock(const std::string& username); |
| 338 void HandleLaunchDemoUser(); | 355 void HandleLaunchDemoUser(); |
| 339 void HandleLaunchIncognito(); | 356 void HandleLaunchIncognito(); |
| 340 void HandleLaunchPublicAccount(const std::string& username); | 357 void HandleLaunchPublicAccount(const std::string& username); |
| 341 void HandleOfflineLogin(const base::ListValue* args); | 358 void HandleOfflineLogin(const base::ListValue* args); |
| 342 void HandleShutdownSystem(); | 359 void HandleShutdownSystem(); |
| 343 void HandleLoadWallpaper(const std::string& email); | 360 void HandleLoadWallpaper(const std::string& email); |
| 344 void HandleRebootSystem(); | 361 void HandleRebootSystem(); |
| 345 void HandleRemoveUser(const std::string& email); | 362 void HandleRemoveUser(const std::string& email); |
| 346 void HandleShowAddUser(const base::ListValue* args); | 363 void HandleShowAddUser(const base::ListValue* args); |
| 347 void HandleToggleEnrollmentScreen(); | 364 void HandleToggleEnrollmentScreen(); |
| 348 void HandleToggleKioskEnableScreen(); | 365 void HandleToggleKioskEnableScreen(); |
| 349 void HandleToggleResetScreen(); | 366 void HandleToggleResetScreen(); |
| 350 void HandleToggleKioskAutolaunchScreen(); | 367 void HandleToggleKioskAutolaunchScreen(); |
| 351 void HandleCreateAccount(); | 368 void HandleCreateAccount(); |
| 352 void HandleAccountPickerReady(); | 369 void HandleAccountPickerReady(); |
| 353 void HandleWallpaperReady(); | 370 void HandleWallpaperReady(); |
| 371 void HandleLoginWebuiReady(); |
| 354 void HandleSignOutUser(); | 372 void HandleSignOutUser(); |
| 355 void HandleOpenProxySettings(); | 373 void HandleOpenProxySettings(); |
| 356 void HandleLoginVisible(const std::string& source); | 374 void HandleLoginVisible(const std::string& source); |
| 357 void HandleCancelPasswordChangedFlow(); | 375 void HandleCancelPasswordChangedFlow(); |
| 358 void HandleCancelUserAdding(); | 376 void HandleCancelUserAdding(); |
| 359 void HandleMigrateUserData(const std::string& password); | 377 void HandleMigrateUserData(const std::string& password); |
| 360 void HandleResyncUserData(); | 378 void HandleResyncUserData(); |
| 361 void HandleLoginUIStateChanged(const std::string& source, bool new_value); | 379 void HandleLoginUIStateChanged(const std::string& source, bool new_value); |
| 362 void HandleUnlockOnLoginSuccess(); | 380 void HandleUnlockOnLoginSuccess(); |
| 363 void HandleLoginScreenUpdate(); | 381 void HandleLoginScreenUpdate(); |
| 364 void HandleShowLoadingTimeoutError(); | 382 void HandleShowLoadingTimeoutError(); |
| 365 void HandleUpdateOfflineLogin(bool offline_login_active); | 383 void HandleUpdateOfflineLogin(bool offline_login_active); |
| 366 void HandleShowLocallyManagedUserCreationScreen(); | 384 void HandleShowLocallyManagedUserCreationScreen(); |
| 367 void HandleFocusPod(const std::string& user_id); | 385 void HandleFocusPod(const std::string& user_id); |
| 368 void HandleLaunchKioskApp(const std::string& app_id, bool diagnostic_mode); | 386 void HandleLaunchKioskApp(const std::string& app_id, bool diagnostic_mode); |
| 369 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); | 387 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); |
| 370 | 388 |
| 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(); |
| 371 | 400 |
| 372 // Returns true iff | 401 // Returns true iff |
| 373 // (i) log in is restricted to some user list, | 402 // (i) log in is restricted to some user list, |
| 374 // (ii) all users in the restricted list are present. | 403 // (ii) all users in the restricted list are present. |
| 375 bool AllWhitelistedUsersPresent(); | 404 bool AllWhitelistedUsersPresent(); |
| 376 | 405 |
| 377 // Cancels password changed flow - switches back to login screen. | 406 // Cancels password changed flow - switches back to login screen. |
| 378 // Called as a callback after cookies are cleared. | 407 // Called as a callback after cookies are cleared. |
| 379 void CancelPasswordChangedFlowInternal(); | 408 void CancelPasswordChangedFlowInternal(); |
| 380 | 409 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 391 // Returns true if current screen is the error screen over signin | 420 // Returns true if current screen is the error screen over signin |
| 392 // screen. | 421 // screen. |
| 393 bool IsSigninScreenHiddenByError() const; | 422 bool IsSigninScreenHiddenByError() const; |
| 394 | 423 |
| 395 // Returns true if guest signin is allowed. | 424 // Returns true if guest signin is allowed. |
| 396 bool IsGuestSigninAllowed() const; | 425 bool IsGuestSigninAllowed() const; |
| 397 | 426 |
| 398 // Returns true if offline login is allowed. | 427 // Returns true if offline login is allowed. |
| 399 bool IsOfflineLoginAllowed() const; | 428 bool IsOfflineLoginAllowed() const; |
| 400 | 429 |
| 401 bool ShouldLoadGaia() const; | 430 // Attempts login for test. |
| 431 void SubmitLoginFormForTest(); |
| 402 | 432 |
| 403 // Update current input method (namely keyboard layout) to LRU by this user. | 433 // Update current input method (namely keyboard layout) to LRU by this user. |
| 404 void SetUserInputMethod(const std::string& username); | 434 void SetUserInputMethod(const std::string& username); |
| 405 | 435 |
| 406 // Invoked when auto enrollment check progresses to decide whether to | 436 // Invoked when auto enrollment check progresses to decide whether to |
| 407 // continue kiosk enable flow. Kiosk enable flow is resumed when | 437 // continue kiosk enable flow. Kiosk enable flow is resumed when |
| 408 // |state| indicates that enrollment is not applicable. | 438 // |state| indicates that enrollment is not applicable. |
| 409 void ContinueKioskEnableFlow(policy::AutoEnrollmentState state); | 439 void ContinueKioskEnableFlow(policy::AutoEnrollmentState state); |
| 410 | 440 |
| 411 // Shows signin. | 441 // Shows signin screen for |email|. |
| 412 void OnShowAddUser(); | 442 void OnShowAddUser(const std::string& email); |
| 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); |
| 413 | 447 |
| 414 GaiaScreenHandler::FrameState FrameState() const; | 448 GaiaScreenHandler::FrameState FrameState() const; |
| 415 net::Error FrameError() const; | 449 net::Error FrameError() const; |
| 416 | 450 |
| 417 // input_method::ImeKeyboard::Observer implementation: | 451 // input_method::ImeKeyboard::Observer implementation: |
| 418 virtual void OnCapsLockChanged(bool enabled) OVERRIDE; | 452 virtual void OnCapsLockChanged(bool enabled) OVERRIDE; |
| 419 | 453 |
| 420 // Current UI state of the signin screen. | 454 // Current UI state of the signin screen. |
| 421 UIState ui_state_; | 455 UIState ui_state_; |
| 422 | 456 |
| 423 // A delegate that glues this handler with backend LoginDisplay. | 457 // A delegate that glues this handler with backend LoginDisplay. |
| 424 SigninScreenHandlerDelegate* delegate_; | 458 SigninScreenHandlerDelegate* delegate_; |
| 425 | 459 |
| 426 // A delegate used to get gfx::NativeWindow. | 460 // A delegate used to get gfx::NativeWindow. |
| 427 NativeWindowDelegate* native_window_delegate_; | 461 NativeWindowDelegate* native_window_delegate_; |
| 428 | 462 |
| 429 // Whether screen should be shown right after initialization. | 463 // Whether screen should be shown right after initialization. |
| 430 bool show_on_init_; | 464 bool show_on_init_; |
| 431 | 465 |
| 432 // Keeps whether screen should be shown for OOBE. | 466 // Keeps whether screen should be shown for OOBE. |
| 433 bool oobe_ui_; | 467 bool oobe_ui_; |
| 434 | 468 |
| 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 |
| 435 // Is account picker being shown for the first time. | 478 // Is account picker being shown for the first time. |
| 436 bool is_account_picker_showing_first_time_; | 479 bool is_account_picker_showing_first_time_; |
| 437 | 480 |
| 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 |
| 438 // Network state informer used to keep signin screen up. | 490 // Network state informer used to keep signin screen up. |
| 439 scoped_refptr<NetworkStateInformer> network_state_informer_; | 491 scoped_refptr<NetworkStateInformer> network_state_informer_; |
| 440 | 492 |
| 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 |
| 441 // Set to true once |LOGIN_WEBUI_VISIBLE| notification is observed. | 509 // Set to true once |LOGIN_WEBUI_VISIBLE| notification is observed. |
| 442 bool webui_visible_; | 510 bool webui_visible_; |
| 443 bool preferences_changed_delayed_; | 511 bool preferences_changed_delayed_; |
| 444 | 512 |
| 445 ErrorScreenActor* error_screen_actor_; | 513 ErrorScreenActor* error_screen_actor_; |
| 446 CoreOobeActor* core_oobe_actor_; | 514 CoreOobeActor* core_oobe_actor_; |
| 447 | 515 |
| 448 bool is_first_update_state_call_; | 516 bool is_first_update_state_call_; |
| 449 bool offline_login_active_; | 517 bool offline_login_active_; |
| 450 NetworkStateInformer::State last_network_state_; | 518 NetworkStateInformer::State last_network_state_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 466 | 534 |
| 467 base::Closure kiosk_enable_flow_aborted_callback_for_test_; | 535 base::Closure kiosk_enable_flow_aborted_callback_for_test_; |
| 468 | 536 |
| 469 // Non-owning ptr. | 537 // Non-owning ptr. |
| 470 // TODO (ygorshenin@): remove this dependency. | 538 // TODO (ygorshenin@): remove this dependency. |
| 471 GaiaScreenHandler* gaia_screen_handler_; | 539 GaiaScreenHandler* gaia_screen_handler_; |
| 472 | 540 |
| 473 // Helper that retrieves the authenticated user's e-mail address. | 541 // Helper that retrieves the authenticated user's e-mail address. |
| 474 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; | 542 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; |
| 475 | 543 |
| 476 base::WeakPtrFactory<SigninScreenHandler> weak_factory_; | |
| 477 | |
| 478 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); | 544 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); |
| 479 }; | 545 }; |
| 480 | 546 |
| 481 } // namespace chromeos | 547 } // namespace chromeos |
| 482 | 548 |
| 483 #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 |