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

Unified Diff: google_apis/gaia/gaia_auth_util.cc

Issue 1162103003: ListAccounts will return the Gaia ID as well as the email of the account. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 | « google_apis/gaia/gaia_auth_util.h ('k') | google_apis/gaia/gaia_auth_util_unittest.cc » ('j') | 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 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;
+}
+
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);
+ }
}
}
}
« no previous file with comments | « google_apis/gaia/gaia_auth_util.h ('k') | google_apis/gaia/gaia_auth_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698