Chromium Code Reviews| 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 3a9ccab63db6c34604261e8f2538a6fbcb5c719a..33be5a803c1ebf35f43531cd4dab601c74899f9a 100644 |
| --- a/google_apis/gaia/gaia_auth_util.cc |
| +++ b/google_apis/gaia/gaia_auth_util.cc |
| @@ -43,6 +43,18 @@ std::string CanonicalizeEmailImpl(const std::string& email_address, |
| } // namespace |
| + |
| +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; |
|
Roger Tawa OOO till Jul 10th
2015/06/02 21:58:42
Do we need to check all fields? Should be enough
|
| +} |
| + |
| std::string CanonicalizeEmail(const std::string& email_address) { |
| // CanonicalizeEmail() is called to process email strings that are eventually |
| // shown to the user, and may also be used in persisting email strings. To |
| @@ -94,8 +106,7 @@ bool IsGaiaSignonRealm(const GURL& url) { |
| bool ParseListAccountsData( |
| - const std::string& data, |
| - std::vector<std::pair<std::string, bool> >* accounts) { |
| + const std::string& data, std::vector<ListedAccount>* accounts) { |
| accounts->clear(); |
| // Parse returned data and make sure we have data. |
| @@ -128,8 +139,16 @@ bool ParseListAccountsData( |
| if (!account->GetInteger(9, &is_email_valid)) |
| is_email_valid = 1; |
| - accounts->push_back( |
| - std::make_pair(CanonicalizeEmail(email), is_email_valid != 0)); |
| + std::string gaia_id; |
| + // ListAccounts must also return the Gaia Id. |
| + if (account->GetString(10, &gaia_id) && !gaia_id.empty()) { |
| + ListedAccount listed_account; |
| + listed_account.email = CanonicalizeEmail(email); |
| + listed_account.gaia_id = gaia_id; |
| + listed_account.valid = is_email_valid != 0; |
| + listed_account.raw_email = email; |
| + accounts->push_back(listed_account); |
| + } |
| } |
| } |
| } |