summaryrefslogtreecommitdiff
path: root/chromium/google_apis/gaia/oauth2_token_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/google_apis/gaia/oauth2_token_service.h')
-rw-r--r--chromium/google_apis/gaia/oauth2_token_service.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/chromium/google_apis/gaia/oauth2_token_service.h b/chromium/google_apis/gaia/oauth2_token_service.h
index d092430f9a5..1745315abf4 100644
--- a/chromium/google_apis/gaia/oauth2_token_service.h
+++ b/chromium/google_apis/gaia/oauth2_token_service.h
@@ -56,6 +56,7 @@ class OAuth2TokenService : public base::NonThreadSafe {
class Request {
public:
virtual ~Request();
+ virtual std::string GetAccountId() const = 0;
protected:
Request();
};
@@ -111,11 +112,9 @@ class OAuth2TokenService : public base::NonThreadSafe {
// |scopes| is the set of scopes to get an access token for, |consumer| is
// the object that will be called back with results if the returned request
// is not deleted.
- // TODO(atwilson): Make this non-virtual when we change
- // ProfileOAuth2TokenServiceRequestTest to use FakeProfileOAuth2TokenService.
- virtual scoped_ptr<Request> StartRequest(const std::string& account_id,
- const ScopeSet& scopes,
- Consumer* consumer);
+ scoped_ptr<Request> StartRequest(const std::string& account_id,
+ const ScopeSet& scopes,
+ Consumer* consumer);
// This method does the same as |StartRequest| except it uses |client_id| and
// |client_secret| to identify OAuth client app instead of using
@@ -179,9 +178,12 @@ class OAuth2TokenService : public base::NonThreadSafe {
public Request {
public:
// |consumer| is required to outlive this.
- explicit RequestImpl(Consumer* consumer);
+ explicit RequestImpl(const std::string& account_id, Consumer* consumer);
virtual ~RequestImpl();
+ // Overridden from Request:
+ virtual std::string GetAccountId() const OVERRIDE;
+
// Informs |consumer_| that this request is completed.
void InformConsumer(const GoogleServiceAuthError& error,
const std::string& access_token,
@@ -189,6 +191,7 @@ class OAuth2TokenService : public base::NonThreadSafe {
private:
// |consumer_| to call back when this request completes.
+ const std::string account_id_;
Consumer* const consumer_;
};
@@ -225,9 +228,16 @@ class OAuth2TokenService : public base::NonThreadSafe {
void CancelRequestsForAccount(const std::string& account_id);
// Called by subclasses to notify observers.
- void FireRefreshTokenAvailable(const std::string& account_id);
- void FireRefreshTokenRevoked(const std::string& account_id);
- void FireRefreshTokensLoaded();
+ virtual void FireRefreshTokenAvailable(const std::string& account_id);
+ virtual void FireRefreshTokenRevoked(const std::string& account_id);
+ virtual void FireRefreshTokensLoaded();
+
+ // Creates a request implementation. Can be overriden by derived classes to
+ // provide additional control of token consumption. |consumer| will outlive
+ // the created request.
+ virtual scoped_ptr<RequestImpl> CreateRequest(
+ const std::string& account_id,
+ Consumer* consumer);
// Fetches an OAuth token for the specified client/scopes. Virtual so it can
// be overridden for tests and for platform-specific behavior on Android.