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