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

Unified Diff: google_apis/gaia/gaia_auth_util.cc

Issue 1166373006: Prefer to use the AccountID to the Email from ListAccounts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 5 years, 6 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 | « components/signin/core/browser/gaia_cookie_manager_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/gaia_auth_util.cc
diff --git a/google_apis/gaia/gaia_auth_util.cc b/google_apis/gaia/gaia_auth_util.cc
index 33be5a803c1ebf35f43531cd4dab601c74899f9a..e9ec5454dda76cf34b4895f2f81b843dc6b6c586 100644
--- a/google_apis/gaia/gaia_auth_util.cc
+++ b/google_apis/gaia/gaia_auth_util.cc
@@ -49,10 +49,16 @@ ListedAccount::ListedAccount() {}
ListedAccount::~ListedAccount() {}
bool ListedAccount::operator==(const ListedAccount& other) const {
- return email == other.email &&
- gaia_id == other.gaia_id &&
- valid == other.valid &&
- raw_email == other.raw_email;
+ // Only use ids for comparison if they've been computed by some caller, since
+ // this class does not assign the id.
+ if (!id.empty() && !other.id.empty()) {
+ return id == other.id;
+ } else {
+ return email == other.email &&
+ gaia_id == other.gaia_id &&
+ valid == other.valid &&
+ raw_email == other.raw_email;
+ }
Roger Tawa OOO till Jul 10th 2015/06/09 19:16:52 Maybe DHCECK that either both |id|s are set or the
Mike Lerman 2015/06/09 19:29:20 Why? It could very well be that one ListedAccount
Roger Tawa OOO till Jul 10th 2015/06/09 19:33:25 OK, makes sense. I was sure if there was a case w
}
std::string CanonicalizeEmail(const std::string& email_address) {
« no previous file with comments | « components/signin/core/browser/gaia_cookie_manager_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698