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

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

Issue 15421011: Use OAuth2 token for sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/oauth2_token_service.h" 5 #include "chrome/browser/signin/oauth2_token_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 return NULL; 433 return NULL;
434 } 434 }
435 return &token_iterator->second; 435 return &token_iterator->second;
436 } 436 }
437 437
438 bool OAuth2TokenService::RemoveCacheEntry( 438 bool OAuth2TokenService::RemoveCacheEntry(
439 const OAuth2TokenService::ScopeSet& scopes, 439 const OAuth2TokenService::ScopeSet& scopes,
440 const std::string& token_to_remove) { 440 const std::string& token_to_remove) {
441 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 441 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
442 TokenCache::iterator token_iterator = token_cache_.find(scopes); 442 TokenCache::iterator token_iterator = token_cache_.find(scopes);
443 if (token_iterator == token_cache_.end() && 443 if (token_iterator != token_cache_.end() &&
tim (not reviewing) 2013/05/23 19:03:41 I guess this wasn't being used very commonly?
Andrew T Wilson (Slow) 2013/05/24 14:10:15 I guess not. It's mostly an optimization anyway (i
pavely 2013/05/30 07:42:12 If server returns AUTH_ERROR before token expires
Andrew T Wilson (Slow) 2013/05/31 12:57:28 Yes. Since every token in OAuth2TokenService has a
444 token_iterator->second.access_token == token_to_remove) { 444 token_iterator->second.access_token == token_to_remove) {
445 token_cache_.erase(token_iterator); 445 token_cache_.erase(token_iterator);
446 return true; 446 return true;
447 } 447 }
448 return false; 448 return false;
449 } 449 }
450 450
451 void OAuth2TokenService::RegisterCacheEntry( 451 void OAuth2TokenService::RegisterCacheEntry(
452 const std::string& refresh_token, 452 const std::string& refresh_token,
453 const OAuth2TokenService::ScopeSet& scopes, 453 const OAuth2TokenService::ScopeSet& scopes,
(...skipping 11 matching lines...) Expand all
465 } 465 }
466 466
467 void OAuth2TokenService::ClearCache() { 467 void OAuth2TokenService::ClearCache() {
468 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 468 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
469 token_cache_.clear(); 469 token_cache_.clear();
470 } 470 }
471 471
472 int OAuth2TokenService::cache_size_for_testing() const { 472 int OAuth2TokenService::cache_size_for_testing() const {
473 return token_cache_.size(); 473 return token_cache_.size();
474 } 474 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/signin_tracker_unittest.cc » ('j') | chrome/browser/sync/profile_sync_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698