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/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/chromeos_switches.h" | |
10 #include "chromeos/dbus/cryptohome/key.pb.h" | 11 #include "chromeos/dbus/cryptohome/key.pb.h" |
12 #include "components/signin/core/account_id/account_id.h" | |
11 | 13 |
12 namespace cryptohome { | 14 namespace cryptohome { |
15 namespace { | |
13 | 16 |
14 Identification::Identification(const std::string& user_id) : user_id(user_id) { | 17 const std::string GetCryptohomeId(const AccountId& account_id) { |
18 // Guest account has empty GaiaId. Default to email. | |
xiyuan
2016/02/17 23:14:25
Think this is true all non-Gaia accounts in additi
Alexander Alekseev
2016/02/18 13:45:14
Done.
| |
19 if (account_id.GetGaiaId().empty()) | |
20 return account_id.GetUserEmail(); // Migrated | |
21 | |
22 const bool is_gaiaid_migration_started = | |
23 chromeos::switches::IsGaiaIdMigrationStarted(); | |
24 return is_gaiaid_migration_started ? account_id.GetGaiaIdKey() | |
25 : account_id.GetUserEmail(); // Migrated | |
26 } | |
27 | |
28 } // anonymous namespace | |
29 | |
30 Identification::Identification(const AccountId& account_id) | |
31 : id_(GetCryptohomeId(account_id)) {} | |
32 | |
33 Identification::Identification(const std::string& id) : id_(id) {} | |
34 | |
35 Identification Identification::FromString(const std::string& id) { | |
36 return Identification(id); | |
15 } | 37 } |
16 | 38 |
17 bool Identification::operator==(const Identification& other) const { | 39 bool Identification::operator==(const Identification& other) const { |
18 return user_id == other.user_id; | 40 return id_ == other.id_; |
19 } | 41 } |
20 | 42 |
21 KeyDefinition::AuthorizationData::Secret::Secret() : encrypt(false), | 43 KeyDefinition::AuthorizationData::Secret::Secret() : encrypt(false), |
22 sign(false), | 44 sign(false), |
23 wrapped(false) { | 45 wrapped(false) { |
24 } | 46 } |
25 | 47 |
26 KeyDefinition::AuthorizationData::Secret::Secret( | 48 KeyDefinition::AuthorizationData::Secret::Secret( |
27 bool encrypt, | 49 bool encrypt, |
28 bool sign, | 50 bool sign, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 } | 199 } |
178 | 200 |
179 bool MountParameters::operator==(const MountParameters& other) const { | 201 bool MountParameters::operator==(const MountParameters& other) const { |
180 return ephemeral == other.ephemeral && create_keys == other.create_keys; | 202 return ephemeral == other.ephemeral && create_keys == other.create_keys; |
181 } | 203 } |
182 | 204 |
183 MountParameters::~MountParameters() { | 205 MountParameters::~MountParameters() { |
184 } | 206 } |
185 | 207 |
186 } // namespace cryptohome | 208 } // namespace cryptohome |
OLD | NEW |