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

Unified Diff: google_apis/gaia/gaia_auth_util.cc

Issue 166433005: Add URL parameter so that /ListAccounts returns valid json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromeos compile error Created 6 years, 10 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
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 8c8f4e5b4a29c73d4122cf06e8bcbd8b1069e386..d181447770a72b22565656c22da64ca0c6e7deae 100644
--- a/google_apis/gaia/gaia_auth_util.cc
+++ b/google_apis/gaia/gaia_auth_util.cc
@@ -75,8 +75,9 @@ bool IsGaiaSignonRealm(const GURL& url) {
}
-bool ParseListAccountsData(const std::string& data,
- std::vector<std::string>* accounts) {
+bool ParseListAccountsData(
+ const std::string& data,
+ std::vector<std::pair<std::string, bool> >* accounts) {
accounts->clear();
// Parse returned data and make sure we have data.
@@ -100,8 +101,18 @@ bool ParseListAccountsData(const std::string& data,
if (account_list->GetList(i, &account) && account != NULL) {
std::string email;
// Canonicalize the email since ListAccounts returns "display email".
- if (account->GetString(3, &email) && !email.empty())
- accounts->push_back(CanonicalizeEmail(email));
+ if (account->GetString(3, &email) && !email.empty()) {
+ // New version if ListAccounts indicates whether the email's session
+ // is still valid or not. If this value is present and false, assume
+ // its invalid. Otherwise assume its valid to remain compatible with
bartfab (slow) 2014/02/17 15:22:04 Nit: s/its/it's/g
Roger Tawa OOO till Jul 10th 2014/02/18 19:37:54 Done.
+ // old version.
+ int is_email_valid = 1;
+ if (account->GetSize() > 9 && !account->GetInteger(9, &is_email_valid))
bartfab (slow) 2014/02/17 15:22:04 Nit: No need to check GetSize() here. If the size
Roger Tawa OOO till Jul 10th 2014/02/18 19:37:54 Done.
+ is_email_valid = 1;
+
+ accounts->push_back(
+ std::make_pair(CanonicalizeEmail(email), is_email_valid != 0));
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698