diff options
author | msarda@chromium.org <msarda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-13 13:28:20 +0000 |
---|---|---|
committer | msarda@chromium.org <msarda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-13 13:28:20 +0000 |
commit | 6ce127516f7e2a118e9d0f4c0e6e656be7502e2a (patch) | |
tree | 675e11e59bed6c0b0c60505ed272d41291fce965 /google_apis/gaia/fake_oauth2_token_service.h | |
parent | 0dc85512d800fd271b1bf7cd8cda9eac8fe48a6b (diff) | |
download | chromium_src-6ce127516f7e2a118e9d0f4c0e6e656be7502e2a.zip chromium_src-6ce127516f7e2a118e9d0f4c0e6e656be7502e2a.tar.gz chromium_src-6ce127516f7e2a118e9d0f4c0e6e656be7502e2a.tar.bz2 |
Add create access token fetcher to OAuthTokenService.
This CL add a factory method to create access token fetchers in the
OAuth2 token service. This allows subclasses to create specific access
token fetchers and re-use the OAuth2 caching logic without duplicating
the code.
TBR=atwilson, blundell, gene
BUG=320625
Review URL: https://codereview.chromium.org/193043002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256816 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/gaia/fake_oauth2_token_service.h')
-rw-r--r-- | google_apis/gaia/fake_oauth2_token_service.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/google_apis/gaia/fake_oauth2_token_service.h b/google_apis/gaia/fake_oauth2_token_service.h index 2554bd4..8c267e5 100644 --- a/google_apis/gaia/fake_oauth2_token_service.h +++ b/google_apis/gaia/fake_oauth2_token_service.h @@ -5,6 +5,7 @@ #ifndef GOOGLE_APIS_GAIA_FAKE_OAUTH2_TOKEN_SERVICE_H_ #define GOOGLE_APIS_GAIA_FAKE_OAUTH2_TOKEN_SERVICE_H_ +#include <set> #include <string> #include "base/compiler_specific.h" @@ -20,6 +21,12 @@ class FakeOAuth2TokenService : public OAuth2TokenService { FakeOAuth2TokenService(); virtual ~FakeOAuth2TokenService(); + void AddAccount(const std::string& account_id); + + void set_request_context(net::URLRequestContextGetter* request_context) { + request_context_ = request_context; + } + protected: // OAuth2TokenService overrides. virtual void FetchOAuth2Token(RequestImpl* request, @@ -34,13 +41,21 @@ class FakeOAuth2TokenService : public OAuth2TokenService { const ScopeSet& scopes, const std::string& access_token) OVERRIDE; - virtual std::string GetRefreshToken(const std::string& account_id) - const OVERRIDE; + virtual bool RefreshTokenIsAvailable(const std::string& account_id) const + OVERRIDE; private: // OAuth2TokenService overrides. virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; + virtual OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( + const std::string& account_id, + net::URLRequestContextGetter* getter, + OAuth2AccessTokenConsumer* consumer) OVERRIDE; + + std::set<std::string> account_ids_; + net::URLRequestContextGetter* request_context_; // weak + DISALLOW_COPY_AND_ASSIGN(FakeOAuth2TokenService); }; |