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

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

Issue 23767004: Revert "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, 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,
172 const std::string& refresh_token, 171 const std::string& refresh_token,
173 const ScopeSet& scopes, 172 const ScopeSet& scopes,
174 const std::string& access_token, 173 const std::string& access_token,
175 const base::Time& expiration_date) { 174 const base::Time& expiration_date) {
176 if (ShouldCacheForRefreshToken(TokenServiceFactory::GetForProfile(profile_), 175 if (ShouldCacheForRefreshToken(TokenServiceFactory::GetForProfile(profile_),
177 refresh_token)) { 176 refresh_token)) {
178 OAuth2TokenService::RegisterCacheEntry(client_id, 177 OAuth2TokenService::RegisterCacheEntry(refresh_token,
179 refresh_token,
180 scopes, 178 scopes,
181 access_token, 179 access_token,
182 expiration_date); 180 expiration_date);
183 } 181 }
184 } 182 }
185 183
186 bool ProfileOAuth2TokenService::ShouldCacheForRefreshToken( 184 bool ProfileOAuth2TokenService::ShouldCacheForRefreshToken(
187 TokenService *token_service, 185 TokenService *token_service,
188 const std::string& refresh_token) { 186 const std::string& refresh_token) {
189 if (!token_service || 187 if (!token_service ||
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 314 }
317 } 315 }
318 316
319 if (!old_login_token.empty() && 317 if (!old_login_token.empty() &&
320 refresh_tokens_.count(GetAccountId(profile_)) == 0) { 318 refresh_tokens_.count(GetAccountId(profile_)) == 0) {
321 UpdateCredentials(GetAccountId(profile_), old_login_token); 319 UpdateCredentials(GetAccountId(profile_), old_login_token);
322 } 320 }
323 321
324 FireRefreshTokensLoaded(); 322 FireRefreshTokensLoaded();
325 } 323 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/profile_oauth2_token_service.h ('k') | chrome/browser/signin/profile_oauth2_token_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698