OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "base/version.h" | 22 #include "base/version.h" |
23 #include "chrome/browser/accessibility/accessibility_events.h" | 23 #include "chrome/browser/accessibility/accessibility_events.h" |
24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
25 #include "chrome/browser/browser_process_platform_part.h" | 25 #include "chrome/browser/browser_process_platform_part.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
28 #include "chrome/browser/chromeos/boot_times_loader.h" | 28 #include "chrome/browser/chromeos/boot_times_loader.h" |
29 #include "chrome/browser/chromeos/customization_document.h" | 29 #include "chrome/browser/chromeos/customization_document.h" |
30 #include "chrome/browser/chromeos/first_run/first_run.h" | 30 #include "chrome/browser/chromeos/first_run/first_run.h" |
31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
32 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" | |
33 #include "chrome/browser/chromeos/login/helper.h" | 32 #include "chrome/browser/chromeos/login/helper.h" |
34 #include "chrome/browser/chromeos/login/login_utils.h" | 33 #include "chrome/browser/chromeos/login/login_utils.h" |
35 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 34 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
36 #include "chrome/browser/chromeos/login/startup_utils.h" | 35 #include "chrome/browser/chromeos/login/startup_utils.h" |
37 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 36 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
38 #include "chrome/browser/chromeos/login/user_flow.h" | 37 #include "chrome/browser/chromeos/login/user_flow.h" |
39 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 38 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
40 #include "chrome/browser/chromeos/login/wizard_controller.h" | 39 #include "chrome/browser/chromeos/login/wizard_controller.h" |
41 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 40 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
42 #include "chrome/browser/chromeos/policy/device_local_account.h" | 41 #include "chrome/browser/chromeos/policy/device_local_account.h" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 BootTimesLoader::Get()->RecordLoginAttempted(); | 453 BootTimesLoader::Get()->RecordLoginAttempted(); |
455 | 454 |
456 // Disable UI while loading user profile. | 455 // Disable UI while loading user profile. |
457 login_display_->SetUIEnabled(false); | 456 login_display_->SetUIEnabled(false); |
458 | 457 |
459 // Use the same LoginPerformer for subsequent login as it has state | 458 // Use the same LoginPerformer for subsequent login as it has state |
460 // such as Authenticator instance. | 459 // such as Authenticator instance. |
461 if (!login_performer_.get() || num_login_attempts_ <= 1) { | 460 if (!login_performer_.get() || num_login_attempts_ <= 1) { |
462 // Only one instance of LoginPerformer should exist at a time. | 461 // Only one instance of LoginPerformer should exist at a time. |
463 login_performer_.reset(NULL); | 462 login_performer_.reset(NULL); |
464 login_performer_.reset(new ChromeLoginPerformer(this)); | 463 login_performer_.reset(new LoginPerformer(this)); |
465 } | 464 } |
466 | 465 |
467 is_login_in_progress_ = true; | 466 is_login_in_progress_ = true; |
468 if (gaia::ExtractDomainName(user_context.GetUserID()) == | 467 if (gaia::ExtractDomainName(user_context.GetUserID()) == |
469 chromeos::login::kSupervisedUserDomain) { | 468 chromeos::login::kSupervisedUserDomain) { |
470 login_performer_->LoginAsSupervisedUser(user_context); | 469 login_performer_->LoginAsSupervisedUser(user_context); |
471 } else { | 470 } else { |
472 login_performer_->PerformLogin(user_context, auth_mode); | 471 login_performer_->PerformLogin(user_context, auth_mode); |
473 } | 472 } |
474 SendAccessibilityAlert( | 473 SendAccessibilityAlert( |
475 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); | 474 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); |
476 } | 475 } |
477 | 476 |
478 void ExistingUserController::LoginAsRetailModeUser() { | 477 void ExistingUserController::LoginAsRetailModeUser() { |
479 // Stop the auto-login timer when attempting login. | 478 // Stop the auto-login timer when attempting login. |
480 StopPublicSessionAutoLoginTimer(); | 479 StopPublicSessionAutoLoginTimer(); |
481 | 480 |
482 // Disable clicking on other windows. | 481 // Disable clicking on other windows. |
483 login_display_->SetUIEnabled(false); | 482 login_display_->SetUIEnabled(false); |
484 // TODO(rkc): Add a CHECK to make sure retail mode logins are allowed once | 483 // TODO(rkc): Add a CHECK to make sure retail mode logins are allowed once |
485 // the enterprise policy wiring is done for retail mode. | 484 // the enterprise policy wiring is done for retail mode. |
486 | 485 |
487 // Only one instance of LoginPerformer should exist at a time. | 486 // Only one instance of LoginPerformer should exist at a time. |
488 login_performer_.reset(NULL); | 487 login_performer_.reset(NULL); |
489 login_performer_.reset(new ChromeLoginPerformer(this)); | 488 login_performer_.reset(new LoginPerformer(this)); |
490 is_login_in_progress_ = true; | 489 is_login_in_progress_ = true; |
491 login_performer_->LoginRetailMode(); | 490 login_performer_->LoginRetailMode(); |
492 SendAccessibilityAlert( | 491 SendAccessibilityAlert( |
493 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_DEMOUSER)); | 492 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_DEMOUSER)); |
494 } | 493 } |
495 | 494 |
496 void ExistingUserController::LoginAsGuest() { | 495 void ExistingUserController::LoginAsGuest() { |
497 if (is_login_in_progress_ || | 496 if (is_login_in_progress_ || |
498 user_manager::UserManager::Get()->IsUserLoggedIn()) { | 497 user_manager::UserManager::Get()->IsUserLoggedIn()) { |
499 return; | 498 return; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); | 533 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); |
535 // Reenable clicking on other windows and status area. | 534 // Reenable clicking on other windows and status area. |
536 login_display_->SetUIEnabled(true); | 535 login_display_->SetUIEnabled(true); |
537 StartPublicSessionAutoLoginTimer(); | 536 StartPublicSessionAutoLoginTimer(); |
538 display_email_.clear(); | 537 display_email_.clear(); |
539 return; | 538 return; |
540 } | 539 } |
541 | 540 |
542 // Only one instance of LoginPerformer should exist at a time. | 541 // Only one instance of LoginPerformer should exist at a time. |
543 login_performer_.reset(NULL); | 542 login_performer_.reset(NULL); |
544 login_performer_.reset(new ChromeLoginPerformer(this)); | 543 login_performer_.reset(new LoginPerformer(this)); |
545 is_login_in_progress_ = true; | 544 is_login_in_progress_ = true; |
546 login_performer_->LoginOffTheRecord(); | 545 login_performer_->LoginOffTheRecord(); |
547 SendAccessibilityAlert( | 546 SendAccessibilityAlert( |
548 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_OFFRECORD)); | 547 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_OFFRECORD)); |
549 } | 548 } |
550 | 549 |
551 void ExistingUserController::MigrateUserData(const std::string& old_password) { | 550 void ExistingUserController::MigrateUserData(const std::string& old_password) { |
552 // LoginPerformer instance has state of the user so it should exist. | 551 // LoginPerformer instance has state of the user so it should exist. |
553 if (login_performer_.get()) | 552 if (login_performer_.get()) |
554 login_performer_->RecoverEncryptedData(old_password); | 553 login_performer_->RecoverEncryptedData(old_password); |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 DCHECK(!keyboard_layout.empty()); | 1247 DCHECK(!keyboard_layout.empty()); |
1249 new_user_context.SetPublicSessionInputMethod(keyboard_layout); | 1248 new_user_context.SetPublicSessionInputMethod(keyboard_layout); |
1250 | 1249 |
1251 LoginAsPublicSessionInternal(new_user_context); | 1250 LoginAsPublicSessionInternal(new_user_context); |
1252 } | 1251 } |
1253 | 1252 |
1254 void ExistingUserController::LoginAsPublicSessionInternal( | 1253 void ExistingUserController::LoginAsPublicSessionInternal( |
1255 const UserContext& user_context) { | 1254 const UserContext& user_context) { |
1256 // Only one instance of LoginPerformer should exist at a time. | 1255 // Only one instance of LoginPerformer should exist at a time. |
1257 login_performer_.reset(NULL); | 1256 login_performer_.reset(NULL); |
1258 login_performer_.reset(new ChromeLoginPerformer(this)); | 1257 login_performer_.reset(new LoginPerformer(this)); |
1259 is_login_in_progress_ = true; | 1258 is_login_in_progress_ = true; |
1260 login_performer_->LoginAsPublicSession(user_context); | 1259 login_performer_->LoginAsPublicSession(user_context); |
1261 SendAccessibilityAlert( | 1260 SendAccessibilityAlert( |
1262 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_PUBLIC_ACCOUNT)); | 1261 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_PUBLIC_ACCOUNT)); |
1263 } | 1262 } |
1264 | 1263 |
1265 } // namespace chromeos | 1264 } // namespace chromeos |
OLD | NEW |