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

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 ListAccount strings in tests 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
« 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 8c8f4e5b4a29c73d4122cf06e8bcbd8b1069e386..6532d190b8e9075a815347a66156df93aeee45cc 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 it's valid to remain compatible with
+ // old version.
+ int is_email_valid = 1;
+ if (!account->GetInteger(9, &is_email_valid))
+ is_email_valid = 1;
+
+ accounts->push_back(
+ std::make_pair(CanonicalizeEmail(email), is_email_valid != 0));
+ }
}
}
« 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