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

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: fixes for bustes tests Created 7 years, 3 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 NOTREACHED() << "Invalid notification type=" << type; 161 NOTREACHED() << "Invalid notification type=" << type;
162 break; 162 break;
163 } 163 }
164 } 164 }
165 165
166 GoogleServiceAuthError ProfileOAuth2TokenService::GetAuthStatus() const { 166 GoogleServiceAuthError ProfileOAuth2TokenService::GetAuthStatus() const {
167 return last_auth_error_; 167 return last_auth_error_;
168 } 168 }
169 169
170 void ProfileOAuth2TokenService::RegisterCacheEntry( 170 void ProfileOAuth2TokenService::RegisterCacheEntry(
171 const std::string& client_id,
171 const std::string& refresh_token, 172 const std::string& refresh_token,
172 const ScopeSet& scopes, 173 const ScopeSet& scopes,
173 const std::string& access_token, 174 const std::string& access_token,
174 const base::Time& expiration_date) { 175 const base::Time& expiration_date) {
175 if (ShouldCacheForRefreshToken(TokenServiceFactory::GetForProfile(profile_), 176 if (ShouldCacheForRefreshToken(TokenServiceFactory::GetForProfile(profile_),
176 refresh_token)) { 177 refresh_token)) {
177 OAuth2TokenService::RegisterCacheEntry(refresh_token, 178 OAuth2TokenService::RegisterCacheEntry(client_id,
179 refresh_token,
178 scopes, 180 scopes,
179 access_token, 181 access_token,
180 expiration_date); 182 expiration_date);
181 } 183 }
182 } 184 }
183 185
184 bool ProfileOAuth2TokenService::ShouldCacheForRefreshToken( 186 bool ProfileOAuth2TokenService::ShouldCacheForRefreshToken(
185 TokenService *token_service, 187 TokenService *token_service,
186 const std::string& refresh_token) { 188 const std::string& refresh_token) {
187 if (!token_service || 189 if (!token_service ||
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 316 }
315 } 317 }
316 318
317 if (!old_login_token.empty() && 319 if (!old_login_token.empty() &&
318 refresh_tokens_.count(GetAccountId(profile_)) == 0) { 320 refresh_tokens_.count(GetAccountId(profile_)) == 0) {
319 UpdateCredentials(GetAccountId(profile_), old_login_token); 321 UpdateCredentials(GetAccountId(profile_), old_login_token);
320 } 322 }
321 323
322 FireRefreshTokensLoaded(); 324 FireRefreshTokensLoaded();
323 } 325 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/profile_oauth2_token_service.h ('k') | chrome/browser/sync/test_profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698