Index: chrome/browser/signin/profile_oauth2_token_service.h |
diff --git a/chrome/browser/signin/profile_oauth2_token_service.h b/chrome/browser/signin/profile_oauth2_token_service.h |
index 311873dde26fb66cb84530b721011451871e17b4..62d14abfb45302676f2d6cdce540ce2e4b7af555 100644 |
--- a/chrome/browser/signin/profile_oauth2_token_service.h |
+++ b/chrome/browser/signin/profile_oauth2_token_service.h |
@@ -58,9 +58,11 @@ class ProfileOAuth2TokenService : public OAuth2TokenService, |
// SigninGlobalError::AuthStatusProvider implementation. |
virtual GoogleServiceAuthError GetAuthStatus() const OVERRIDE; |
- // Takes injected TokenService for testing. |
- bool ShouldCacheForRefreshToken(TokenService *token_service, |
- const std::string& refresh_token); |
+ // Gets an account id of the primary account related to the profile. |
+ std::string GetPrimaryAccountId(); |
+ |
+ // Lists account IDs of all accounts with a refresh token. |
+ virtual std::vector<std::string> GetAccounts() OVERRIDE; |
// Updates a |refresh_token| for an |account_id|. Credentials are persisted, |
// and avialable through |LoadCredentials| after service is restarted. |
@@ -89,30 +91,28 @@ class ProfileOAuth2TokenService : public OAuth2TokenService, |
virtual ~ProfileOAuth2TokenService(); |
// OAuth2TokenService overrides. |
- virtual std::string GetRefreshToken() OVERRIDE; |
+ virtual std::string GetRefreshToken(const std::string& account_id) OVERRIDE; |
// OAuth2TokenService implementation. |
virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
// Updates the internal cache of the result from the most-recently-completed |
// auth request (used for reporting errors to the user). |
- virtual void UpdateAuthError(const GoogleServiceAuthError& error) OVERRIDE; |
- |
- // Overridden to not cache tokens if the TokenService refresh token |
- // changes while a token fetch is in-flight. If the user logs out and |
- // logs back in with a different account, then any in-flight token |
- // fetches will be for the old account's refresh token. Therefore |
- // when they come back, they shouldn't be cached. |
- virtual void RegisterCacheEntry(const std::string& client_id, |
- const std::string& refresh_token, |
- const ScopeSet& scopes, |
- const std::string& access_token, |
- const base::Time& expiration_date) OVERRIDE; |
+ virtual void UpdateAuthError( |
+ const std::string& account_id, |
+ const GoogleServiceAuthError& error) OVERRIDE; |
+ |
+ // Persists credentials for |account_id|. Enables overriding for |
+ // testing purposes, or other cases, when accessing the DB is not desired. |
+ virtual void PersistCredentials(const std::string& account_id, |
+ const std::string& refresh_token); |
+ |
+ // Clears credentials persisted for |account_id|. Enables overriding for |
+ // testing purposes, or other cases, when accessing the DB is not desired. |
+ virtual void ClearPersistedCredentials(const std::string& account_id); |
private: |
FRIEND_TEST_ALL_PREFIXES(ProfileOAuth2TokenServiceTest, |
- StaleRefreshTokensNotCached); |
- FRIEND_TEST_ALL_PREFIXES(ProfileOAuth2TokenServiceTest, |
TokenServiceUpdateClearsCache); |
FRIEND_TEST_ALL_PREFIXES(ProfileOAuth2TokenServiceTest, |
PersistenceDBUpgrade); |