summaryrefslogtreecommitdiffstats
path: root/google_apis
diff options
context:
space:
mode:
authormlerman <mlerman@chromium.org>2015-06-09 15:09:57 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-09 22:11:42 +0000
commitf91ef5151598b01fdca8ebf9ad94b01f4b1cf22e (patch)
tree828ccc09e01adecc055758a5e7fb2d671edd0f5b /google_apis
parent8f81c5d9936bfec63253f11d6c53f59a266ef427 (diff)
downloadchromium_src-f91ef5151598b01fdca8ebf9ad94b01f4b1cf22e.zip
chromium_src-f91ef5151598b01fdca8ebf9ad94b01f4b1cf22e.tar.gz
chromium_src-f91ef5151598b01fdca8ebf9ad94b01f4b1cf22e.tar.bz2
Prefer to use the AccountID to the Email from ListAccounts.
This CL follows https://codereview.chromium.org/1162103003/ BUG=492787 Review URL: https://codereview.chromium.org/1166373006 Cr-Commit-Position: refs/heads/master@{#333586}
Diffstat (limited to 'google_apis')
-rw-r--r--google_apis/gaia/gaia_auth_util.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/google_apis/gaia/gaia_auth_util.cc b/google_apis/gaia/gaia_auth_util.cc
index 33be5a8..e9ec545 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;
+ }
}
std::string CanonicalizeEmail(const std::string& email_address) {