Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "google_apis/gaia/gaia_auth_util.h" | 5 #include "google_apis/gaia/gaia_auth_util.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace | 44 } // namespace |
| 45 | 45 |
| 46 | 46 |
| 47 ListedAccount::ListedAccount() {} | 47 ListedAccount::ListedAccount() {} |
| 48 | 48 |
| 49 ListedAccount::~ListedAccount() {} | 49 ListedAccount::~ListedAccount() {} |
| 50 | 50 |
| 51 bool ListedAccount::operator==(const ListedAccount& other) const { | 51 bool ListedAccount::operator==(const ListedAccount& other) const { |
| 52 return email == other.email && | 52 // Only use ids for comparison if they've been computed by some caller, since |
| 53 gaia_id == other.gaia_id && | 53 // this class does not assign the id. |
| 54 valid == other.valid && | 54 if (!id.empty() && !other.id.empty()) { |
| 55 raw_email == other.raw_email; | 55 return id == other.id; |
| 56 } else { | |
| 57 return email == other.email && | |
| 58 gaia_id == other.gaia_id && | |
| 59 valid == other.valid && | |
| 60 raw_email == other.raw_email; | |
| 61 } | |
|
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
| |
| 56 } | 62 } |
| 57 | 63 |
| 58 std::string CanonicalizeEmail(const std::string& email_address) { | 64 std::string CanonicalizeEmail(const std::string& email_address) { |
| 59 // CanonicalizeEmail() is called to process email strings that are eventually | 65 // CanonicalizeEmail() is called to process email strings that are eventually |
| 60 // shown to the user, and may also be used in persisting email strings. To | 66 // shown to the user, and may also be used in persisting email strings. To |
| 61 // avoid breaking this existing behavior, this function will not try to | 67 // avoid breaking this existing behavior, this function will not try to |
| 62 // change googlemail to gmail. | 68 // change googlemail to gmail. |
| 63 return CanonicalizeEmailImpl(email_address, false); | 69 return CanonicalizeEmailImpl(email_address, false); |
| 64 } | 70 } |
| 65 | 71 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 accounts->push_back(listed_account); | 156 accounts->push_back(listed_account); |
| 151 } | 157 } |
| 152 } | 158 } |
| 153 } | 159 } |
| 154 } | 160 } |
| 155 | 161 |
| 156 return true; | 162 return true; |
| 157 } | 163 } |
| 158 | 164 |
| 159 } // namespace gaia | 165 } // namespace gaia |
| OLD | NEW |