| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 base::CommandLine::ForCurrentProcess()->HasSwitch( | 171 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 172 chromeos::switches::kLoginManager) && | 172 chromeos::switches::kLoginManager) && |
| 173 !session_manager::SessionManager::Get()->IsSessionStarted(); | 173 !session_manager::SessionManager::Get()->IsSessionStarted(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void RecordPasswordChangeFlow(LoginPasswordChangeFlow flow) { | 176 void RecordPasswordChangeFlow(LoginPasswordChangeFlow flow) { |
| 177 UMA_HISTOGRAM_ENUMERATION("Login.PasswordChangeFlow", flow, | 177 UMA_HISTOGRAM_ENUMERATION("Login.PasswordChangeFlow", flow, |
| 178 LOGIN_PASSWORD_CHANGE_FLOW_COUNT); | 178 LOGIN_PASSWORD_CHANGE_FLOW_COUNT); |
| 179 } | 179 } |
| 180 | 180 |
| 181 bool ShouldForceDircrypto() { | 181 bool ShouldForceDircrypto(const AccountId& account_id) { |
| 182 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 182 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 183 chromeos::switches::kDisableEncryptionMigration) && | 183 chromeos::switches::kDisableEncryptionMigration)) { |
| 184 arc::IsArcAvailable(); | 184 return false; |
| 185 } |
| 186 // If the device is not officially supported to run ARC, we don't need to |
| 187 // force Ext4 dircrypto. |
| 188 if (!arc::IsArcAvailable()) |
| 189 return false; |
| 190 |
| 191 // In some login flows (e.g. when siging in supervised user), ARC can not |
| 192 // start. For such cases, we don't need to force Ext4 dircrypto. |
| 193 chromeos::UserFlow* user_flow = |
| 194 chromeos::ChromeUserManager::Get()->GetUserFlow(account_id); |
| 195 if (!user_flow || !user_flow->CanStartArc()) |
| 196 return false; |
| 197 |
| 198 // When a user is signing in as a secondary user, we don't need to force Ext4 |
| 199 // dircrypto since the user can not run ARC. |
| 200 if (UserAddingScreen::Get()->IsRunning()) |
| 201 return false; |
| 202 |
| 203 return true; |
| 185 } | 204 } |
| 186 | 205 |
| 187 } // namespace | 206 } // namespace |
| 188 | 207 |
| 189 // static | 208 // static |
| 190 ExistingUserController* ExistingUserController::current_controller_ = nullptr; | 209 ExistingUserController* ExistingUserController::current_controller_ = nullptr; |
| 191 | 210 |
| 192 //////////////////////////////////////////////////////////////////////////////// | 211 //////////////////////////////////////////////////////////////////////////////// |
| 193 // ExistingUserController, public: | 212 // ExistingUserController, public: |
| 194 | 213 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 } | 484 } |
| 466 | 485 |
| 467 if (gaia::ExtractDomainName(user_context.GetAccountId().GetUserEmail()) == | 486 if (gaia::ExtractDomainName(user_context.GetAccountId().GetUserEmail()) == |
| 468 user_manager::kSupervisedUserDomain) { | 487 user_manager::kSupervisedUserDomain) { |
| 469 login_performer_->LoginAsSupervisedUser(user_context); | 488 login_performer_->LoginAsSupervisedUser(user_context); |
| 470 } else { | 489 } else { |
| 471 // If a regular user log in to a device which supports ARC, we should make | 490 // If a regular user log in to a device which supports ARC, we should make |
| 472 // sure that the user's cryptohome is encrypted in ext4 dircrypto to run the | 491 // sure that the user's cryptohome is encrypted in ext4 dircrypto to run the |
| 473 // latest Android runtime. | 492 // latest Android runtime. |
| 474 UserContext new_user_context = user_context; | 493 UserContext new_user_context = user_context; |
| 475 new_user_context.SetIsForcingDircrypto(ShouldForceDircrypto()); | 494 new_user_context.SetIsForcingDircrypto( |
| 495 ShouldForceDircrypto(new_user_context.GetAccountId())); |
| 476 login_performer_->PerformLogin(new_user_context, auth_mode); | 496 login_performer_->PerformLogin(new_user_context, auth_mode); |
| 477 RecordPasswordLoginEvent(new_user_context); | 497 RecordPasswordLoginEvent(new_user_context); |
| 478 } | 498 } |
| 479 SendAccessibilityAlert( | 499 SendAccessibilityAlert( |
| 480 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); | 500 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); |
| 481 } | 501 } |
| 482 | 502 |
| 483 void ExistingUserController::ContinuePerformLogin( | 503 void ExistingUserController::ContinuePerformLogin( |
| 484 LoginPerformer::AuthorizationMode auth_mode, | 504 LoginPerformer::AuthorizationMode auth_mode, |
| 485 const UserContext& user_context) { | 505 const UserContext& user_context) { |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); | 1455 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); |
| 1436 } | 1456 } |
| 1437 | 1457 |
| 1438 void ExistingUserController::ClearRecordedNames() { | 1458 void ExistingUserController::ClearRecordedNames() { |
| 1439 display_email_.clear(); | 1459 display_email_.clear(); |
| 1440 display_name_.clear(); | 1460 display_name_.clear(); |
| 1441 given_name_.clear(); | 1461 given_name_.clear(); |
| 1442 } | 1462 } |
| 1443 | 1463 |
| 1444 } // namespace chromeos | 1464 } // namespace chromeos |
| OLD | NEW |