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

Unified Diff: chrome/browser/signin/oauth2_token_service.h

Issue 12880014: Get OAuth2TokenService working on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable unit test on Android -- it doesn't make sense. Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/web_history_service.cc ('k') | chrome/browser/signin/oauth2_token_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/oauth2_token_service.h
diff --git a/chrome/browser/signin/oauth2_token_service.h b/chrome/browser/signin/oauth2_token_service.h
index 3f19b3c0817954e516767854af99d7beceb27cc1..71ddcb27944c21cc1ce3fbdd59517131e8e6149f 100644
--- a/chrome/browser/signin/oauth2_token_service.h
+++ b/chrome/browser/signin/oauth2_token_service.h
@@ -99,6 +99,13 @@ class OAuth2TokenService : public content::NotificationObserver,
const ScopeSet& scopes,
OAuth2TokenService::Consumer* consumer);
+ // Mark an OAuth2 access token as invalid. This should be done if the token
+ // was received from this class, but was not accepted by the server (e.g.,
+ // the server returned 401 Unauthorized). The token will be removed from the
+ // cache for the given scopes.
+ void InvalidateToken(const ScopeSet& scopes,
+ const std::string& invalid_token);
+
// content::NotificationObserver
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -118,9 +125,9 @@ class OAuth2TokenService : public content::NotificationObserver,
// Informs the consumer of |request| fetch results.
static void InformConsumer(
base::WeakPtr<OAuth2TokenService::RequestImpl> request,
- GoogleServiceAuthError error,
- std::string access_token,
- base::Time expiration_date);
+ const GoogleServiceAuthError& error,
+ const std::string& access_token,
+ const base::Time& expiration_date);
// Struct that contains the information of an OAuth2 access token.
struct CacheEntry {
@@ -133,6 +140,7 @@ class OAuth2TokenService : public content::NotificationObserver,
// ensure no entry with the same |scopes| is added before the usage of the
// returned entry is done.
const CacheEntry* GetCacheEntry(const ScopeSet& scopes);
+
// Registers a new access token in the cache if |refresh_token| is the one
// currently held by TokenService.
void RegisterCacheEntry(const std::string& refresh_token,
@@ -140,6 +148,12 @@ class OAuth2TokenService : public content::NotificationObserver,
const std::string& access_token,
const base::Time& expiration_date);
+ // Removes an access token for the given set of scopes from the cache.
+ // Returns true if the entry was removed, otherwise false.
+ bool RemoveCacheEntry(const OAuth2TokenService::ScopeSet& scopes,
+ const std::string& token_to_remove);
+
+
// Called when |fetcher| finishes fetching.
void OnFetchComplete(Fetcher* fetcher);
« no previous file with comments | « chrome/browser/history/web_history_service.cc ('k') | chrome/browser/signin/oauth2_token_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698