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

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

Issue 1425093004: Revert of This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Created 5 years, 2 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') | components/user_manager.gypi » ('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..1f630c278ec127526483c132308a11605c36f18d 100644
--- a/chromeos/login/auth/user_context.cc
+++ b/chromeos/login/auth/user_context.cc
@@ -7,10 +7,14 @@
namespace chromeos {
-UserContext::UserContext() : account_id_(EmptyAccountId()) {}
+UserContext::UserContext()
+ : is_using_oauth_(true),
+ auth_flow_(AUTH_FLOW_OFFLINE),
+ user_type_(user_manager::USER_TYPE_REGULAR) {
+}
UserContext::UserContext(const UserContext& other)
- : account_id_(other.account_id_),
+ : user_id_(other.user_id_),
gaia_id_(other.gaia_id_),
key_(other.key_),
auth_code_(other.auth_code_),
@@ -23,28 +27,32 @@
public_session_locale_(other.public_session_locale_),
public_session_input_method_(other.public_session_input_method_),
device_id_(other.device_id_),
- gaps_cookie_(other.gaps_cookie_) {}
+ gaps_cookie_(other.gaps_cookie_) {
+}
-UserContext::UserContext(const AccountId& account_id)
- : account_id_(account_id) {
- account_id_.SetUserEmail(
- login::CanonicalizeUserID(account_id.GetUserEmail()));
+UserContext::UserContext(const std::string& user_id)
+ : user_id_(login::CanonicalizeUserID(user_id)),
+ is_using_oauth_(true),
+ auth_flow_(AUTH_FLOW_OFFLINE),
+ user_type_(user_manager::USER_TYPE_REGULAR) {
}
UserContext::UserContext(user_manager::UserType user_type,
const std::string& user_id)
- : account_id_(EmptyAccountId()), user_type_(user_type) {
+ : is_using_oauth_(true),
+ auth_flow_(AUTH_FLOW_OFFLINE),
+ user_type_(user_type) {
if (user_type_ == user_manager::USER_TYPE_REGULAR)
- account_id_ = AccountId::FromUserEmail(login::CanonicalizeUserID(user_id));
+ user_id_ = login::CanonicalizeUserID(user_id);
else
- account_id_ = AccountId::FromUserEmail(user_id);
+ user_id_ = user_id;
}
UserContext::~UserContext() {
}
bool UserContext::operator==(const UserContext& context) const {
- return context.account_id_ == account_id_ && context.gaia_id_ == gaia_id_ &&
+ return context.user_id_ == user_id_ && context.gaia_id_ == gaia_id_ &&
context.key_ == key_ && context.auth_code_ == auth_code_ &&
context.refresh_token_ == refresh_token_ &&
context.access_token_ == access_token_ &&
@@ -59,8 +67,8 @@
return !(*this == context);
}
-const AccountId& UserContext::GetAccountId() const {
- return account_id_;
+const std::string& UserContext::GetUserID() const {
+ return user_id_;
}
const std::string& UserContext::GetGaiaID() const {
@@ -120,12 +128,12 @@
}
bool UserContext::HasCredentials() const {
- return (account_id_.is_valid() && !key_.GetSecret().empty()) ||
+ return (!user_id_.empty() && !key_.GetSecret().empty()) ||
!auth_code_.empty();
}
void UserContext::SetUserID(const std::string& user_id) {
- account_id_ = AccountId::FromUserEmail(login::CanonicalizeUserID(user_id));
+ user_id_ = login::CanonicalizeUserID(user_id);
}
void UserContext::SetGaiaID(const std::string& gaia_id) {
« no previous file with comments | « chromeos/login/auth/user_context.h ('k') | components/user_manager.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698