Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: chromeos/login/auth/cryptohome_authenticator.cc

Issue 2529103002: Add account_type into AccountId (Closed)
Patch Set: Fix MultiUserWindowManagerChromeOSTest.* Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const bool already_migrated = cryptohome::GetGaiaIdMigrationStatus( 221 const bool already_migrated = cryptohome::GetGaiaIdMigrationStatus(
222 attempt->user_context.GetAccountId()); 222 attempt->user_context.GetAccountId());
223 const bool has_gaia_id = 223 const bool has_account_key =
224 !attempt->user_context.GetAccountId().GetGaiaId().empty(); 224 attempt->user_context.GetAccountId().HasAccountIdKey();
225 225
226 bool need_migration = false; 226 bool need_migration = false;
227 if (!create_if_nonexistent && !already_migrated) { 227 if (!create_if_nonexistent && !already_migrated) {
228 if (has_gaia_id) { 228 if (has_account_key) {
229 need_migration = true; 229 need_migration = true;
230 } else { 230 } else {
231 LOG(WARNING) << "Account '" 231 LOG(WARNING) << "Account '"
232 << attempt->user_context.GetAccountId().Serialize() 232 << attempt->user_context.GetAccountId().Serialize()
233 << "' has no gaia id. Cryptohome migration skipped."; 233 << "' has no gaia id. Cryptohome migration skipped.";
234 } 234 }
235 } 235 }
236 if (need_migration) { 236 if (need_migration) {
237 chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker( 237 chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(
238 "CryptohomeRename-Start", false); 238 "CryptohomeRename-Start", false);
239 const std::string& cryptohome_id_from = 239 const std::string& cryptohome_id_from =
240 attempt->user_context.GetAccountId().GetUserEmail(); // Migrated 240 attempt->user_context.GetAccountId().GetUserEmail(); // Migrated
241 const std::string cryptohome_id_to = 241 const std::string cryptohome_id_to =
242 attempt->user_context.GetAccountId().GetAccountIdKey(); 242 attempt->user_context.GetAccountId().GetAccountIdKey();
243 243
244 cryptohome::HomedirMethods::GetInstance()->RenameCryptohome( 244 cryptohome::HomedirMethods::GetInstance()->RenameCryptohome(
245 cryptohome::Identification::FromString(cryptohome_id_from), 245 cryptohome::Identification::FromString(cryptohome_id_from),
246 cryptohome::Identification::FromString(cryptohome_id_to), 246 cryptohome::Identification::FromString(cryptohome_id_to),
247 base::Bind(&OnCryptohomeRenamed, attempt, resolver, ephemeral, 247 base::Bind(&OnCryptohomeRenamed, attempt, resolver, ephemeral,
248 create_if_nonexistent)); 248 create_if_nonexistent));
249 return; 249 return;
250 } 250 }
251 if (!already_migrated && has_gaia_id) { 251 if (!already_migrated && has_account_key) {
252 // Mark new users migrated. 252 // Mark new users migrated.
253 cryptohome::SetGaiaIdMigrationStatusDone( 253 cryptohome::SetGaiaIdMigrationStatusDone(
254 attempt->user_context.GetAccountId()); 254 attempt->user_context.GetAccountId());
255 } 255 }
256 if (already_migrated) { 256 if (already_migrated) {
257 UMACryptohomeMigrationToGaiaId( 257 UMACryptohomeMigrationToGaiaId(
258 CryptohomeMigrationToGaiaId::ALREADY_MIGRATED); 258 CryptohomeMigrationToGaiaId::ALREADY_MIGRATED);
259 } 259 }
260 260
261 DoMount(attempt, resolver, ephemeral, create_if_nonexistent); 261 DoMount(attempt, resolver, ephemeral, create_if_nonexistent);
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 Resolve(); 997 Resolve();
998 } 998 }
999 999
1000 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, 1000 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished,
1001 bool check_result) { 1001 bool check_result) {
1002 owner_is_verified_ = owner_check_finished; 1002 owner_is_verified_ = owner_check_finished;
1003 user_can_login_ = check_result; 1003 user_can_login_ = check_result;
1004 } 1004 }
1005 1005
1006 } // namespace chromeos 1006 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/cryptohome/cryptohome_parameters.cc ('k') | chromeos/tpm/tpm_token_info_getter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698