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

Unified Diff: chrome/browser/signin/google_auto_login_helper.cc

Issue 63253003: Fix issues with token refresh in AccountReconcilor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added missing files Created 7 years, 1 month 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: chrome/browser/signin/google_auto_login_helper.cc
diff --git a/chrome/browser/signin/google_auto_login_helper.cc b/chrome/browser/signin/google_auto_login_helper.cc
index 09cb58a6827945e21241be7770792d1d6e1c5ed4..16699fe9e17302b27e9d94a31b03f55792cc7119 100644
--- a/chrome/browser/signin/google_auto_login_helper.cc
+++ b/chrome/browser/signin/google_auto_login_helper.cc
@@ -15,18 +15,22 @@ GoogleAutoLoginHelper::GoogleAutoLoginHelper(Profile* profile)
GoogleAutoLoginHelper::~GoogleAutoLoginHelper() {}
Roger Tawa OOO till Jul 10th 2013/11/27 18:45:43 Should DCHECK that |accounts_| is empty.
acleung1 2013/11/28 00:52:44 Done.
void GoogleAutoLoginHelper::LogIn() {
- uber_token_fetcher_.reset(new UbertokenFetcher(profile_, this));
+ uber_token_fetcher_.reset(CreateNewUbertokenFetcher());
Roger Tawa OOO till Jul 10th 2013/11/27 18:45:43 Add a DCHECK that |accounts_| is empty.
acleung1 2013/11/28 00:52:44 Done.
uber_token_fetcher_->StartFetchingToken();
}
void GoogleAutoLoginHelper::LogIn(const std::string& account_id) {
- uber_token_fetcher_.reset(new UbertokenFetcher(profile_, this));
- uber_token_fetcher_->StartFetchingToken(account_id);
+ if (uber_token_fetcher_.get()) {
+ accounts_.push_back(account_id);
+ } else {
+ uber_token_fetcher_.reset(CreateNewUbertokenFetcher());
+ uber_token_fetcher_->StartFetchingToken(account_id);
+ }
}
void GoogleAutoLoginHelper::OnUbertokenSuccess(const std::string& uber_token) {
- gaia_auth_fetcher_.reset(new GaiaAuthFetcher(
- this, GaiaConstants::kChromeSource, profile_->GetRequestContext()));
+ VLOG(1) << "GoogleAutoLoginHelper::OnUbertokenSuccess" << uber_token;
Roger Tawa OOO till Jul 10th 2013/11/27 18:45:43 Nit: put a space after "Success" in string?
acleung1 2013/11/28 00:52:44 Good point. Actually, the uber token's too noisy.
+ gaia_auth_fetcher_.reset(CreateNewGaiaAuthFetcher());
gaia_auth_fetcher_->StartMergeSession(uber_token);
}
@@ -38,11 +42,29 @@ void GoogleAutoLoginHelper::OnUbertokenFailure(
void GoogleAutoLoginHelper::OnMergeSessionSuccess(const std::string& data) {
DVLOG(1) << "MergeSession successful." << data;
- base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
+ if (accounts_.empty()) {
+ base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
+ } else {
+ uber_token_fetcher_.reset(CreateNewUbertokenFetcher());
+ uber_token_fetcher_->StartFetchingToken(accounts_.front());
+ accounts_.pop_front();
+ }
}
void GoogleAutoLoginHelper::OnMergeSessionFailure(
const GoogleServiceAuthError& error) {
VLOG(1) << "Failed MergeSession request, error: " << error.ToString();
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
+ // TODO(acleung): Depending on the return error we should probably
+ // take different actions instead of just throw our hands up.
Roger Tawa OOO till Jul 10th 2013/11/27 18:45:43 sgtm, but for now please clear out the |accounts_|
acleung1 2013/11/28 00:52:44 Done.
+}
+
+UbertokenFetcher* GoogleAutoLoginHelper::CreateNewUbertokenFetcher() {
+ return new UbertokenFetcher(profile_, this);
}
+
+GaiaAuthFetcher* GoogleAutoLoginHelper::CreateNewGaiaAuthFetcher() {
+ return new GaiaAuthFetcher(
+ this, GaiaConstants::kChromeSource, profile_->GetRequestContext());
+}
+

Powered by Google App Engine
This is Rietveld 408576698