diff options
author | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-12 15:05:33 +0000 |
---|---|---|
committer | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-12 15:05:33 +0000 |
commit | d9f42e52b5d2862f49ef020f1316b206081d71d4 (patch) | |
tree | c5b110afc4defa13a227e8f4cd3d2a626af76ea1 /google_apis/gaia/gaia_auth_util.cc | |
parent | 20f2c04abdc280a0632d19cdbdd7972c3449d4c0 (diff) | |
download | chromium_src-d9f42e52b5d2862f49ef020f1316b206081d71d4.zip chromium_src-d9f42e52b5d2862f49ef020f1316b206081d71d4.tar.gz chromium_src-d9f42e52b5d2862f49ef020f1316b206081d71d4.tar.bz2 |
Keep reconcilor for looping when cookies change.
Changes:
- only listen for cookie changes when connected
- delay the end of the reconcile action until merge sessions are complete
- if /ListAccounts returns an error, just abort the reconcile
- change DVLOG to VLOG so we can turn on logging in canary
BUG=340775
Review URL: https://codereview.chromium.org/152633007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250717 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/gaia/gaia_auth_util.cc')
-rw-r--r-- | google_apis/gaia/gaia_auth_util.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/google_apis/gaia/gaia_auth_util.cc b/google_apis/gaia/gaia_auth_util.cc index 3aabd07..9f15ec0 100644 --- a/google_apis/gaia/gaia_auth_util.cc +++ b/google_apis/gaia/gaia_auth_util.cc @@ -73,36 +73,37 @@ bool IsGaiaSignonRealm(const GURL& url) { } -std::vector<std::string> ParseListAccountsData(const std::string& data) { - std::vector<std::string> account_ids; +bool ParseListAccountsData(const std::string& data, + std::vector<std::string>* accounts) { + accounts->clear(); // Parse returned data and make sure we have data. scoped_ptr<base::Value> value(base::JSONReader::Read(data)); if (!value) - return account_ids; + return false; base::ListValue* list; if (!value->GetAsList(&list) || list->GetSize() < 2) - return account_ids; + return false; // Get list of account info. - base::ListValue* accounts; - if (!list->GetList(1, &accounts) || accounts == NULL) - return account_ids; + base::ListValue* account_list; + if (!list->GetList(1, &account_list) || accounts == NULL) + return false; // Build a vector of accounts from the cookie. Order is important: the first // account in the list is the primary account. - for (size_t i = 0; i < accounts->GetSize(); ++i) { + for (size_t i = 0; i < account_list->GetSize(); ++i) { base::ListValue* account; - if (accounts->GetList(i, &account) && account != NULL) { + 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()) - account_ids.push_back(CanonicalizeEmail(email)); + accounts->push_back(CanonicalizeEmail(email)); } } - return account_ids; + return true; } } // namespace gaia |