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

Side by Side Diff: chromeos/cryptohome/cryptohome_parameters.cc

Issue 2452053002: Rename AccountId method GetGaiaIdKey() to GetAccountIdKey(). (Closed)
Patch Set: Updated comments Created 4 years, 1 month 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/cryptohome/cryptohome_parameters.h" 5 #include "chromeos/cryptohome/cryptohome_parameters.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "chromeos/dbus/cryptohome/key.pb.h" 10 #include "chromeos/dbus/cryptohome/key.pb.h"
11 #include "components/signin/core/account_id/account_id.h" 11 #include "components/signin/core/account_id/account_id.h"
12 #include "components/user_manager/known_user.h" 12 #include "components/user_manager/known_user.h"
13 13
14 namespace cryptohome { 14 namespace cryptohome {
15 namespace { 15 namespace {
16 16
17 // Subsystem name for GaiaId migration status. 17 // Subsystem name for GaiaId migration status.
18 const char kCryptohome[] = "cryptohome"; 18 const char kCryptohome[] = "cryptohome";
19 19
20 const std::string GetCryptohomeId(const AccountId& account_id) { 20 const std::string GetCryptohomeId(const AccountId& account_id) {
21 // Guest/kiosk/managed/public accounts have empty GaiaId. Default to email. 21 // Guest/kiosk/managed/public accounts have empty GaiaId. Default to email.
22 if (account_id.GetGaiaId().empty()) 22 if (account_id.GetGaiaId().empty())
23 return account_id.GetUserEmail(); // Migrated 23 return account_id.GetUserEmail(); // Migrated
24 24
25 if (GetGaiaIdMigrationStatus(account_id)) 25 if (GetGaiaIdMigrationStatus(account_id))
26 return account_id.GetGaiaIdKey(); 26 return account_id.GetAccountIdKey();
27 27
28 return account_id.GetUserEmail(); // Migrated 28 return account_id.GetUserEmail(); // Migrated
29 } 29 }
30 30
31 } // anonymous namespace 31 } // anonymous namespace
32 32
33 Identification::Identification() {} 33 Identification::Identification() {}
34 34
35 Identification::Identification(const AccountId& account_id) 35 Identification::Identification(const AccountId& account_id)
36 : id_(GetCryptohomeId(account_id)) {} 36 : id_(GetCryptohomeId(account_id)) {}
(...skipping 12 matching lines...) Expand all
49 return id_ < right.id_; 49 return id_ < right.id_;
50 } 50 }
51 51
52 AccountId Identification::GetAccountId() const { 52 AccountId Identification::GetAccountId() const {
53 const std::vector<AccountId> known_account_ids = 53 const std::vector<AccountId> known_account_ids =
54 user_manager::known_user::GetKnownAccountIds(); 54 user_manager::known_user::GetKnownAccountIds();
55 55
56 // A LOT of tests start with --login_user <user>, and not registing this user 56 // A LOT of tests start with --login_user <user>, and not registing this user
57 // before. So we might have "known_user" entry without gaia_id. 57 // before. So we might have "known_user" entry without gaia_id.
58 for (const AccountId& known_id : known_account_ids) { 58 for (const AccountId& known_id : known_account_ids) {
59 if (!known_id.GetGaiaId().empty() && known_id.GetGaiaIdKey() == id_) { 59 if (!known_id.GetGaiaId().empty() && known_id.GetAccountIdKey() == id_) {
60 return known_id; 60 return known_id;
61 } 61 }
62 } 62 }
63 63
64 for (const AccountId& known_id : known_account_ids) { 64 for (const AccountId& known_id : known_account_ids) {
65 if (known_id.GetUserEmail() == id_) { 65 if (known_id.GetUserEmail() == id_) {
66 return known_id; 66 return known_id;
67 } 67 }
68 } 68 }
69 69
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } // namespace cryptohome 255 } // namespace cryptohome
256 256
257 namespace BASE_HASH_NAMESPACE { 257 namespace BASE_HASH_NAMESPACE {
258 258
259 std::size_t hash<cryptohome::Identification>::operator()( 259 std::size_t hash<cryptohome::Identification>::operator()(
260 const cryptohome::Identification& cryptohome_id) const { 260 const cryptohome::Identification& cryptohome_id) const {
261 return hash<std::string>()(cryptohome_id.id()); 261 return hash<std::string>()(cryptohome_id.id());
262 } 262 }
263 263
264 } // namespace BASE_HASH_NAMESPACE 264 } // namespace BASE_HASH_NAMESPACE
OLDNEW
« no previous file with comments | « chromeos/cryptohome/cryptohome_parameters.h ('k') | chromeos/login/auth/cryptohome_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698