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

Side by Side Diff: chrome/browser/services/gcm/gcm_account_tracker.cc

Issue 878713002: Fix to the GCM Account Tracker flooding on a stale refresh token (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/services/gcm/gcm_account_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/services/gcm/gcm_account_tracker.h" 5 #include "chrome/browser/services/gcm/gcm_account_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 DCHECK(!request->GetAccountId().empty()); 143 DCHECK(!request->GetAccountId().empty());
144 DVLOG(1) << "Get token failure: " << request->GetAccountId(); 144 DVLOG(1) << "Get token failure: " << request->GetAccountId();
145 145
146 AccountInfos::iterator iter = account_infos_.find(request->GetAccountId()); 146 AccountInfos::iterator iter = account_infos_.find(request->GetAccountId());
147 DCHECK(iter != account_infos_.end()); 147 DCHECK(iter != account_infos_.end());
148 if (iter != account_infos_.end()) { 148 if (iter != account_infos_.end()) {
149 DCHECK(iter->second.state == GETTING_TOKEN || 149 DCHECK(iter->second.state == GETTING_TOKEN ||
150 iter->second.state == ACCOUNT_REMOVED); 150 iter->second.state == ACCOUNT_REMOVED);
151 // If OnAccountSignedOut(..) was called most recently, account is kept in 151 // If OnAccountSignedOut(..) was called most recently, account is kept in
152 // ACCOUNT_REMOVED state. 152 // ACCOUNT_REMOVED state.
153 if (iter->second.state == GETTING_TOKEN) 153 if (iter->second.state == GETTING_TOKEN) {
154 iter->second.state = TOKEN_NEEDED; 154 // Given the fetcher has a built in retry logic, consider this situation
155 // to be invalid refresh token, that is only fixed when user signs in.
156 // Once the users signs in properly the minting will retry.
157 iter->second.access_token.clear();
158 iter->second.state = ACCOUNT_REMOVED;
159 }
155 } 160 }
156 161
157 DeleteTokenRequest(request); 162 DeleteTokenRequest(request);
158 ReportTokens(); 163 ReportTokens();
159 } 164 }
160 165
161 void GCMAccountTracker::OnConnected(const net::IPEndPoint& ip_endpoint) { 166 void GCMAccountTracker::OnConnected(const net::IPEndPoint& ip_endpoint) {
162 if (IsTokenReportingRequired()) 167 if (IsTokenReportingRequired())
163 ReportTokens(); 168 ReportTokens();
164 } 169 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 iter->second.state = ACCOUNT_REMOVED; 343 iter->second.state = ACCOUNT_REMOVED;
339 ReportTokens(); 344 ReportTokens();
340 } 345 }
341 346
342 OAuth2TokenService* GCMAccountTracker::GetTokenService() { 347 OAuth2TokenService* GCMAccountTracker::GetTokenService() {
343 DCHECK(account_tracker_->identity_provider()); 348 DCHECK(account_tracker_->identity_provider());
344 return account_tracker_->identity_provider()->GetTokenService(); 349 return account_tracker_->identity_provider()->GetTokenService();
345 } 350 }
346 351
347 } // namespace gcm 352 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/services/gcm/gcm_account_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698