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

Unified Diff: chromeos/login/auth/user_context.cc

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests. Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/login/auth/user_context.h ('k') | chromeos/tpm/tpm_token_info_getter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/login/auth/user_context.cc
diff --git a/chromeos/login/auth/user_context.cc b/chromeos/login/auth/user_context.cc
index 0060e3c4dec4f658eecf63d79106a47d670b3b1c..7eed5e08d7fad925222fca049e7823ec5ac4f6ef 100644
--- a/chromeos/login/auth/user_context.cc
+++ b/chromeos/login/auth/user_context.cc
@@ -11,7 +11,6 @@ UserContext::UserContext() : account_id_(EmptyAccountId()) {}
UserContext::UserContext(const UserContext& other)
: account_id_(other.account_id_),
- gaia_id_(other.gaia_id_),
key_(other.key_),
auth_code_(other.auth_code_),
refresh_token_(other.refresh_token_),
@@ -32,20 +31,19 @@ UserContext::UserContext(const AccountId& account_id)
}
UserContext::UserContext(user_manager::UserType user_type,
- const std::string& user_id)
- : account_id_(EmptyAccountId()), user_type_(user_type) {
+ const AccountId& account_id)
+ : account_id_(account_id), user_type_(user_type) {
if (user_type_ == user_manager::USER_TYPE_REGULAR)
- account_id_ = AccountId::FromUserEmail(login::CanonicalizeUserID(user_id));
- else
- account_id_ = AccountId::FromUserEmail(user_id);
+ account_id_.SetUserEmail(
+ login::CanonicalizeUserID(account_id_.GetUserEmail()));
}
UserContext::~UserContext() {
}
bool UserContext::operator==(const UserContext& context) const {
- return context.account_id_ == account_id_ && context.gaia_id_ == gaia_id_ &&
- context.key_ == key_ && context.auth_code_ == auth_code_ &&
+ return context.account_id_ == account_id_ && context.key_ == key_ &&
+ context.auth_code_ == auth_code_ &&
context.refresh_token_ == refresh_token_ &&
context.access_token_ == access_token_ &&
context.user_id_hash_ == user_id_hash_ &&
@@ -64,7 +62,7 @@ const AccountId& UserContext::GetAccountId() const {
}
const std::string& UserContext::GetGaiaID() const {
- return gaia_id_;
+ return account_id_.GetGaiaId();
}
const Key* UserContext::GetKey() const {
@@ -124,12 +122,8 @@ bool UserContext::HasCredentials() const {
!auth_code_.empty();
}
-void UserContext::SetUserID(const std::string& user_id) {
- account_id_ = AccountId::FromUserEmail(login::CanonicalizeUserID(user_id));
-}
-
-void UserContext::SetGaiaID(const std::string& gaia_id) {
- gaia_id_ = gaia_id;
+void UserContext::SetAccountId(const AccountId& account_id) {
+ account_id_ = account_id;
}
void UserContext::SetKey(const Key& key) {
« no previous file with comments | « chromeos/login/auth/user_context.h ('k') | chromeos/tpm/tpm_token_info_getter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698