| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/login/auth/cryptohome_authenticator.h" | 5 #include "chromeos/login/auth/cryptohome_authenticator.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 const base::WeakPtr<AuthAttemptState>& attempt, | 211 const base::WeakPtr<AuthAttemptState>& attempt, |
| 212 scoped_refptr<CryptohomeAuthenticator> resolver, | 212 scoped_refptr<CryptohomeAuthenticator> resolver, |
| 213 bool ephemeral, | 213 bool ephemeral, |
| 214 bool create_if_nonexistent) { | 214 bool create_if_nonexistent) { |
| 215 const bool is_gaiaid_migration_started = switches::IsGaiaIdMigrationStarted(); | 215 const bool is_gaiaid_migration_started = switches::IsGaiaIdMigrationStarted(); |
| 216 if (!is_gaiaid_migration_started) { | 216 if (!is_gaiaid_migration_started) { |
| 217 UMACryptohomeMigrationToGaiaId(CryptohomeMigrationToGaiaId::NOT_STARTED); | 217 UMACryptohomeMigrationToGaiaId(CryptohomeMigrationToGaiaId::NOT_STARTED); |
| 218 DoMount(attempt, resolver, ephemeral, create_if_nonexistent); | 218 DoMount(attempt, resolver, ephemeral, create_if_nonexistent); |
| 219 return; | 219 return; |
| 220 } | 220 } |
| 221 if (attempt->user_context.GetAccountId().GetAccountType() == |
| 222 AccountType::ACTIVE_DIRECTORY) { |
| 223 cryptohome::SetGaiaIdMigrationStatusDone( |
| 224 attempt->user_context.GetAccountId()); |
| 225 } |
| 221 const bool already_migrated = cryptohome::GetGaiaIdMigrationStatus( | 226 const bool already_migrated = cryptohome::GetGaiaIdMigrationStatus( |
| 222 attempt->user_context.GetAccountId()); | 227 attempt->user_context.GetAccountId()); |
| 223 const bool has_account_key = | 228 const bool has_account_key = |
| 224 attempt->user_context.GetAccountId().HasAccountIdKey(); | 229 attempt->user_context.GetAccountId().HasAccountIdKey(); |
| 225 | 230 |
| 226 bool need_migration = false; | 231 bool need_migration = false; |
| 227 if (!create_if_nonexistent && !already_migrated) { | 232 if (!create_if_nonexistent && !already_migrated) { |
| 228 if (has_account_key) { | 233 if (has_account_key) { |
| 229 need_migration = true; | 234 need_migration = true; |
| 230 } else { | 235 } else { |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // Reset the verified flag. | 499 // Reset the verified flag. |
| 495 owner_is_verified_ = false; | 500 owner_is_verified_ = false; |
| 496 | 501 |
| 497 StartMount(current_state_->AsWeakPtr(), | 502 StartMount(current_state_->AsWeakPtr(), |
| 498 scoped_refptr<CryptohomeAuthenticator>(this), | 503 scoped_refptr<CryptohomeAuthenticator>(this), |
| 499 false /* ephemeral */, false /* create_if_nonexistent */); | 504 false /* ephemeral */, false /* create_if_nonexistent */); |
| 500 } | 505 } |
| 501 | 506 |
| 502 void CryptohomeAuthenticator::CompleteLogin(content::BrowserContext* context, | 507 void CryptohomeAuthenticator::CompleteLogin(content::BrowserContext* context, |
| 503 const UserContext& user_context) { | 508 const UserContext& user_context) { |
| 504 DCHECK_EQ(user_manager::USER_TYPE_REGULAR, user_context.GetUserType()); | 509 DCHECK(user_context.GetUserType() == user_manager::USER_TYPE_REGULAR || |
| 510 user_context.GetUserType() == |
| 511 user_manager::USER_TYPE_ACTIVE_DIRECTORY); |
| 505 authentication_context_ = context; | 512 authentication_context_ = context; |
| 506 current_state_.reset(new AuthAttemptState(user_context, | 513 current_state_.reset(new AuthAttemptState(user_context, |
| 507 true, // unlock | 514 true, // unlock |
| 508 false, // online_complete | 515 false, // online_complete |
| 509 !IsKnownUser(user_context))); | 516 !IsKnownUser(user_context))); |
| 510 | 517 |
| 511 // Reset the verified flag. | 518 // Reset the verified flag. |
| 512 owner_is_verified_ = false; | 519 owner_is_verified_ = false; |
| 513 | 520 |
| 514 StartMount(current_state_->AsWeakPtr(), | 521 StartMount(current_state_->AsWeakPtr(), |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 Resolve(); | 1004 Resolve(); |
| 998 } | 1005 } |
| 999 | 1006 |
| 1000 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, | 1007 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, |
| 1001 bool check_result) { | 1008 bool check_result) { |
| 1002 owner_is_verified_ = owner_check_finished; | 1009 owner_is_verified_ = owner_check_finished; |
| 1003 user_can_login_ = check_result; | 1010 user_can_login_ = check_result; |
| 1004 } | 1011 } |
| 1005 | 1012 |
| 1006 } // namespace chromeos | 1013 } // namespace chromeos |
| OLD | NEW |