| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 base::CommandLine::ForCurrentProcess()->HasSwitch( | 172 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 173 chromeos::switches::kLoginManager) && | 173 chromeos::switches::kLoginManager) && |
| 174 !session_manager::SessionManager::Get()->IsSessionStarted(); | 174 !session_manager::SessionManager::Get()->IsSessionStarted(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void RecordPasswordChangeFlow(LoginPasswordChangeFlow flow) { | 177 void RecordPasswordChangeFlow(LoginPasswordChangeFlow flow) { |
| 178 UMA_HISTOGRAM_ENUMERATION("Login.PasswordChangeFlow", flow, | 178 UMA_HISTOGRAM_ENUMERATION("Login.PasswordChangeFlow", flow, |
| 179 LOGIN_PASSWORD_CHANGE_FLOW_COUNT); | 179 LOGIN_PASSWORD_CHANGE_FLOW_COUNT); |
| 180 } | 180 } |
| 181 | 181 |
| 182 bool ShouldForceDircrypto() { | 182 bool ShouldForceDircrypto(const AccountId& account_id) { |
| 183 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 183 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 184 chromeos::switches::kDisableEncryptionMigration) && | 184 chromeos::switches::kDisableEncryptionMigration)) { |
| 185 arc::IsArcAvailable(); | 185 return false; |
| 186 } |
| 187 // If the device is not officially supported to run ARC, we don't need to |
| 188 // force Ext4 dircrypto. |
| 189 if (!arc::IsArcAvailable()) |
| 190 return false; |
| 191 |
| 192 // In some login flows (e.g. when siging in supervised user), ARC can not |
| 193 // start. For such cases, we don't need to force Ext4 dircrypto. |
| 194 chromeos::UserFlow* user_flow = |
| 195 chromeos::ChromeUserManager::Get()->GetUserFlow(account_id); |
| 196 if (!user_flow || !user_flow->CanStartArc()) |
| 197 return false; |
| 198 |
| 199 // When a user is signing in as a secondary user, we don't need to force Ext4 |
| 200 // dircrypto since the user can not run ARC. |
| 201 if (UserAddingScreen::Get()->IsRunning()) |
| 202 return false; |
| 203 |
| 204 return true; |
| 186 } | 205 } |
| 187 | 206 |
| 188 } // namespace | 207 } // namespace |
| 189 | 208 |
| 190 // static | 209 // static |
| 191 ExistingUserController* ExistingUserController::current_controller_ = nullptr; | 210 ExistingUserController* ExistingUserController::current_controller_ = nullptr; |
| 192 | 211 |
| 193 //////////////////////////////////////////////////////////////////////////////// | 212 //////////////////////////////////////////////////////////////////////////////// |
| 194 // ExistingUserController, public: | 213 // ExistingUserController, public: |
| 195 | 214 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 } | 503 } |
| 485 | 504 |
| 486 if (gaia::ExtractDomainName(user_context.GetAccountId().GetUserEmail()) == | 505 if (gaia::ExtractDomainName(user_context.GetAccountId().GetUserEmail()) == |
| 487 user_manager::kSupervisedUserDomain) { | 506 user_manager::kSupervisedUserDomain) { |
| 488 login_performer_->LoginAsSupervisedUser(user_context); | 507 login_performer_->LoginAsSupervisedUser(user_context); |
| 489 } else { | 508 } else { |
| 490 // If a regular user log in to a device which supports ARC, we should make | 509 // If a regular user log in to a device which supports ARC, we should make |
| 491 // sure that the user's cryptohome is encrypted in ext4 dircrypto to run the | 510 // sure that the user's cryptohome is encrypted in ext4 dircrypto to run the |
| 492 // latest Android runtime. | 511 // latest Android runtime. |
| 493 UserContext new_user_context = user_context; | 512 UserContext new_user_context = user_context; |
| 494 new_user_context.SetIsForcingDircrypto(ShouldForceDircrypto()); | 513 new_user_context.SetIsForcingDircrypto( |
| 514 ShouldForceDircrypto(new_user_context.GetAccountId())); |
| 495 login_performer_->PerformLogin(new_user_context, auth_mode); | 515 login_performer_->PerformLogin(new_user_context, auth_mode); |
| 496 RecordPasswordLoginEvent(new_user_context); | 516 RecordPasswordLoginEvent(new_user_context); |
| 497 } | 517 } |
| 498 SendAccessibilityAlert( | 518 SendAccessibilityAlert( |
| 499 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); | 519 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); |
| 500 } | 520 } |
| 501 | 521 |
| 502 void ExistingUserController::ContinuePerformLogin( | 522 void ExistingUserController::ContinuePerformLogin( |
| 503 LoginPerformer::AuthorizationMode auth_mode, | 523 LoginPerformer::AuthorizationMode auth_mode, |
| 504 const UserContext& user_context) { | 524 const UserContext& user_context) { |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); | 1493 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); |
| 1474 } | 1494 } |
| 1475 | 1495 |
| 1476 void ExistingUserController::ClearRecordedNames() { | 1496 void ExistingUserController::ClearRecordedNames() { |
| 1477 display_email_.clear(); | 1497 display_email_.clear(); |
| 1478 display_name_.clear(); | 1498 display_name_.clear(); |
| 1479 given_name_.clear(); | 1499 given_name_.clear(); |
| 1480 } | 1500 } |
| 1481 | 1501 |
| 1482 } // namespace chromeos | 1502 } // namespace chromeos |
| OLD | NEW |