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

Side by Side Diff: chrome/browser/signin/profile_oauth2_token_service.cc

Issue 22581003: Handling of multiple concurrent requests from different clients in OAuth2TokenService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/signin/profile_oauth2_token_service.h" 5 #include "chrome/browser/signin/profile_oauth2_token_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 GoogleServiceAuthError ProfileOAuth2TokenService::GetAuthStatus() const { 185 GoogleServiceAuthError ProfileOAuth2TokenService::GetAuthStatus() const {
186 return last_auth_error_; 186 return last_auth_error_;
187 } 187 }
188 188
189 net::URLRequestContextGetter* ProfileOAuth2TokenService::GetRequestContext() { 189 net::URLRequestContextGetter* ProfileOAuth2TokenService::GetRequestContext() {
190 return profile_->GetRequestContext(); 190 return profile_->GetRequestContext();
191 } 191 }
192 192
193 void ProfileOAuth2TokenService::RegisterCacheEntry( 193 void ProfileOAuth2TokenService::RegisterCacheEntry(
194 const std::string& client_id,
194 const std::string& refresh_token, 195 const std::string& refresh_token,
195 const ScopeSet& scopes, 196 const ScopeSet& scopes,
196 const std::string& access_token, 197 const std::string& access_token,
197 const base::Time& expiration_date) { 198 const base::Time& expiration_date) {
198 if (ShouldCacheForRefreshToken(TokenServiceFactory::GetForProfile(profile_), 199 if (ShouldCacheForRefreshToken(TokenServiceFactory::GetForProfile(profile_),
199 refresh_token)) { 200 refresh_token)) {
200 OAuth2TokenService::RegisterCacheEntry(refresh_token, 201 OAuth2TokenService::RegisterCacheEntry(client_id,
202 refresh_token,
201 scopes, 203 scopes,
202 access_token, 204 access_token,
203 expiration_date); 205 expiration_date);
204 } 206 }
205 } 207 }
206 208
207 bool ProfileOAuth2TokenService::ShouldCacheForRefreshToken( 209 bool ProfileOAuth2TokenService::ShouldCacheForRefreshToken(
208 TokenService *token_service, 210 TokenService *token_service,
209 const std::string& refresh_token) { 211 const std::string& refresh_token) {
210 if (!token_service || 212 if (!token_service ||
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 341 }
340 } 342 }
341 343
342 if (!old_login_token.empty() && 344 if (!old_login_token.empty() &&
343 refresh_tokens_.count(GetAccountId(profile_)) == 0) { 345 refresh_tokens_.count(GetAccountId(profile_)) == 0) {
344 UpdateCredentials(GetAccountId(profile_), old_login_token); 346 UpdateCredentials(GetAccountId(profile_), old_login_token);
345 } 347 }
346 348
347 FireRefreshTokensLoaded(); 349 FireRefreshTokensLoaded();
348 } 350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698