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 <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 51 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
52 #include "chrome/common/channel_info.h" | 52 #include "chrome/common/channel_info.h" |
53 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
54 #include "chrome/common/url_constants.h" | 54 #include "chrome/common/url_constants.h" |
55 #include "chrome/grit/generated_resources.h" | 55 #include "chrome/grit/generated_resources.h" |
56 #include "chromeos/chromeos_switches.h" | 56 #include "chromeos/chromeos_switches.h" |
57 #include "chromeos/dbus/dbus_thread_manager.h" | 57 #include "chromeos/dbus/dbus_thread_manager.h" |
58 #include "chromeos/dbus/power_manager_client.h" | 58 #include "chromeos/dbus/power_manager_client.h" |
59 #include "chromeos/dbus/session_manager_client.h" | 59 #include "chromeos/dbus/session_manager_client.h" |
60 #include "chromeos/settings/cros_settings_names.h" | 60 #include "chromeos/settings/cros_settings_names.h" |
| 61 #include "components/arc/arc_util.h" |
61 #include "components/google/core/browser/google_util.h" | 62 #include "components/google/core/browser/google_util.h" |
62 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 63 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
63 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 64 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
64 #include "components/policy/core/common/policy_map.h" | 65 #include "components/policy/core/common/policy_map.h" |
65 #include "components/policy/core/common/policy_service.h" | 66 #include "components/policy/core/common/policy_service.h" |
66 #include "components/policy/core/common/policy_types.h" | 67 #include "components/policy/core/common/policy_types.h" |
67 #include "components/policy/policy_constants.h" | 68 #include "components/policy/policy_constants.h" |
68 #include "components/prefs/pref_service.h" | 69 #include "components/prefs/pref_service.h" |
69 #include "components/session_manager/core/session_manager.h" | 70 #include "components/session_manager/core/session_manager.h" |
70 #include "components/signin/core/account_id/account_id.h" | 71 #include "components/signin/core/account_id/account_id.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 base::CommandLine::ForCurrentProcess()->HasSwitch( | 171 base::CommandLine::ForCurrentProcess()->HasSwitch( |
171 chromeos::switches::kLoginManager) && | 172 chromeos::switches::kLoginManager) && |
172 !session_manager::SessionManager::Get()->IsSessionStarted(); | 173 !session_manager::SessionManager::Get()->IsSessionStarted(); |
173 } | 174 } |
174 | 175 |
175 void RecordPasswordChangeFlow(LoginPasswordChangeFlow flow) { | 176 void RecordPasswordChangeFlow(LoginPasswordChangeFlow flow) { |
176 UMA_HISTOGRAM_ENUMERATION("Login.PasswordChangeFlow", flow, | 177 UMA_HISTOGRAM_ENUMERATION("Login.PasswordChangeFlow", flow, |
177 LOGIN_PASSWORD_CHANGE_FLOW_COUNT); | 178 LOGIN_PASSWORD_CHANGE_FLOW_COUNT); |
178 } | 179 } |
179 | 180 |
| 181 bool ShouldForceDircrypto() { |
| 182 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 183 chromeos::switches::kEnableEncryptionMigration) && |
| 184 (arc::IsArcAvailable() || arc::IsArcKioskAvailable()); |
| 185 } |
| 186 |
180 } // namespace | 187 } // namespace |
181 | 188 |
182 // static | 189 // static |
183 ExistingUserController* ExistingUserController::current_controller_ = nullptr; | 190 ExistingUserController* ExistingUserController::current_controller_ = nullptr; |
184 | 191 |
185 //////////////////////////////////////////////////////////////////////////////// | 192 //////////////////////////////////////////////////////////////////////////////// |
186 // ExistingUserController, public: | 193 // ExistingUserController, public: |
187 | 194 |
188 ExistingUserController::ExistingUserController(LoginDisplayHost* host) | 195 ExistingUserController::ExistingUserController(LoginDisplayHost* host) |
189 : host_(host), | 196 : host_(host), |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 PerformLoginFinishedActions(false /* don't start auto login timer */); | 461 PerformLoginFinishedActions(false /* don't start auto login timer */); |
455 ShowError(IDS_LOGIN_ERROR_GOOGLE_ACCOUNT_NOT_ALLOWED, | 462 ShowError(IDS_LOGIN_ERROR_GOOGLE_ACCOUNT_NOT_ALLOWED, |
456 "Google accounts are not allowed on this device"); | 463 "Google accounts are not allowed on this device"); |
457 return; | 464 return; |
458 } | 465 } |
459 | 466 |
460 if (gaia::ExtractDomainName(user_context.GetAccountId().GetUserEmail()) == | 467 if (gaia::ExtractDomainName(user_context.GetAccountId().GetUserEmail()) == |
461 user_manager::kSupervisedUserDomain) { | 468 user_manager::kSupervisedUserDomain) { |
462 login_performer_->LoginAsSupervisedUser(user_context); | 469 login_performer_->LoginAsSupervisedUser(user_context); |
463 } else { | 470 } else { |
464 login_performer_->PerformLogin(user_context, auth_mode); | 471 // If a regular user log in to a device which supports ARC, we should make |
465 RecordPasswordLoginEvent(user_context); | 472 // sure that the user's cryptohome is encrypted in ext4 dircrypto to run the |
| 473 // latest Android runtime. |
| 474 UserContext new_user_context = user_context; |
| 475 new_user_context.SetIsForcingDircrypto(ShouldForceDircrypto()); |
| 476 login_performer_->PerformLogin(new_user_context, auth_mode); |
| 477 RecordPasswordLoginEvent(new_user_context); |
466 } | 478 } |
467 SendAccessibilityAlert( | 479 SendAccessibilityAlert( |
468 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); | 480 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); |
469 } | 481 } |
470 | 482 |
| 483 void ExistingUserController::ContinuePerformLogin( |
| 484 LoginPerformer::AuthorizationMode auth_mode, |
| 485 const UserContext& user_context) { |
| 486 login_performer_->PerformLogin(user_context, auth_mode); |
| 487 } |
| 488 |
471 void ExistingUserController::MigrateUserData(const std::string& old_password) { | 489 void ExistingUserController::MigrateUserData(const std::string& old_password) { |
472 // LoginPerformer instance has state of the user so it should exist. | 490 // LoginPerformer instance has state of the user so it should exist. |
473 if (login_performer_.get()) { | 491 if (login_performer_.get()) { |
474 VLOG(1) << "Migrate the existing cryptohome to new password."; | 492 VLOG(1) << "Migrate the existing cryptohome to new password."; |
475 login_performer_->RecoverEncryptedData(old_password); | 493 login_performer_->RecoverEncryptedData(old_password); |
476 } | 494 } |
477 } | 495 } |
478 | 496 |
479 void ExistingUserController::OnSigninScreenReady() { | 497 void ExistingUserController::OnSigninScreenReady() { |
480 auto_launch_ready_ = true; | 498 auto_launch_ready_ = true; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 618 |
601 void ExistingUserController::ShowEncryptionMigrationScreen( | 619 void ExistingUserController::ShowEncryptionMigrationScreen( |
602 const UserContext& user_context) { | 620 const UserContext& user_context) { |
603 host_->StartWizard(OobeScreen::SCREEN_ENCRYPTION_MIGRATION); | 621 host_->StartWizard(OobeScreen::SCREEN_ENCRYPTION_MIGRATION); |
604 | 622 |
605 EncryptionMigrationScreen* migration_screen = | 623 EncryptionMigrationScreen* migration_screen = |
606 static_cast<EncryptionMigrationScreen*>( | 624 static_cast<EncryptionMigrationScreen*>( |
607 host_->GetWizardController()->current_screen()); | 625 host_->GetWizardController()->current_screen()); |
608 DCHECK(migration_screen); | 626 DCHECK(migration_screen); |
609 migration_screen->SetUserContext(user_context); | 627 migration_screen->SetUserContext(user_context); |
| 628 migration_screen->SetContinueLoginCallback(base::BindOnce( |
| 629 &ExistingUserController::ContinuePerformLogin, weak_factory_.GetWeakPtr(), |
| 630 login_performer_->auth_mode())); |
610 } | 631 } |
611 | 632 |
612 void ExistingUserController::ShowTPMError() { | 633 void ExistingUserController::ShowTPMError() { |
613 login_display_->SetUIEnabled(false); | 634 login_display_->SetUIEnabled(false); |
614 login_display_->ShowErrorScreen(LoginDisplay::TPM_ERROR); | 635 login_display_->ShowErrorScreen(LoginDisplay::TPM_ERROR); |
615 } | 636 } |
616 | 637 |
617 void ExistingUserController::ShowPasswordChangedDialog() { | 638 void ExistingUserController::ShowPasswordChangedDialog() { |
618 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_PASSWORD_CHANGED); | 639 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_PASSWORD_CHANGED); |
619 | 640 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); | 1431 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); |
1411 } | 1432 } |
1412 | 1433 |
1413 void ExistingUserController::ClearRecordedNames() { | 1434 void ExistingUserController::ClearRecordedNames() { |
1414 display_email_.clear(); | 1435 display_email_.clear(); |
1415 display_name_.clear(); | 1436 display_name_.clear(); |
1416 given_name_.clear(); | 1437 given_name_.clear(); |
1417 } | 1438 } |
1418 | 1439 |
1419 } // namespace chromeos | 1440 } // namespace chromeos |
OLD | NEW |