| Index: google_apis/gaia/oauth2_token_service.h
|
| diff --git a/google_apis/gaia/oauth2_token_service.h b/google_apis/gaia/oauth2_token_service.h
|
| index 967dc93ee35955d714c93e4a0dc16337307aa7b3..6c24fb358dbbbb9c324068dfadbf381a3595c779 100644
|
| --- a/google_apis/gaia/oauth2_token_service.h
|
| +++ b/google_apis/gaia/oauth2_token_service.h
|
| @@ -72,8 +72,6 @@ class OAuth2TokenService : public base::NonThreadSafe {
|
|
|
| // Classes that want to listen for token availability should implement this
|
| // interface and register with the AddObserver() call.
|
| - // TODO(rogerta): may get rid of |error| argument for OnRefreshTokenRevoked()
|
| - // once we stop supporting ClientLogin. Need to evaluate if its still useful.
|
| class Observer {
|
| public:
|
| // Called whenever a new login-scoped refresh token is available for
|
| @@ -87,8 +85,6 @@ class OAuth2TokenService : public base::NonThreadSafe {
|
| // Called after all refresh tokens are loaded during OAuth2TokenService
|
| // startup.
|
| virtual void OnRefreshTokensLoaded() {}
|
| - // Called after all refresh tokens are removed from OAuth2TokenService.
|
| - virtual void OnRefreshTokensCleared() {}
|
| protected:
|
| virtual ~Observer() {}
|
| };
|
| @@ -111,13 +107,15 @@ class OAuth2TokenService : public base::NonThreadSafe {
|
| // is not deleted.
|
| // TODO(atwilson): Make this non-virtual when we change
|
| // ProfileOAuth2TokenServiceRequestTest to use FakeProfileOAuth2TokenService.
|
| - virtual scoped_ptr<Request> StartRequest(const ScopeSet& scopes,
|
| + virtual 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
|
| // Chrome's default values.
|
| scoped_ptr<Request> StartRequestForClient(
|
| + const std::string& account_id,
|
| const std::string& client_id,
|
| const std::string& client_secret,
|
| const ScopeSet& scopes,
|
| @@ -127,13 +125,17 @@ class OAuth2TokenService : public base::NonThreadSafe {
|
| // context given by |getter| instead of using the one returned by
|
| // |GetRequestContext| implemented by derived classes.
|
| scoped_ptr<Request> StartRequestWithContext(
|
| + const std::string& account_id,
|
| net::URLRequestContextGetter* getter,
|
| const ScopeSet& scopes,
|
| Consumer* consumer);
|
|
|
| + // Lists account IDs of all accounts with a refresh token.
|
| + virtual std::vector<std::string> GetAccounts();
|
| +
|
| // Returns true if a refresh token exists. If false, calls to
|
| // |StartRequest| will result in a Consumer::OnGetTokenFailure callback.
|
| - virtual bool RefreshTokenIsAvailable();
|
| + virtual bool RefreshTokenIsAvailable(const std::string& account_id);
|
|
|
| // 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.,
|
| @@ -170,10 +172,12 @@ class OAuth2TokenService : public base::NonThreadSafe {
|
|
|
| // Subclasses should return the refresh token maintained.
|
| // If no token is available, return an empty string.
|
| - virtual std::string GetRefreshToken() = 0;
|
| + virtual std::string GetRefreshToken(const std::string& account_id) = 0;
|
|
|
| // Subclasses can override if they want to report errors to the user.
|
| - virtual void UpdateAuthError(const GoogleServiceAuthError& error);
|
| + virtual void UpdateAuthError(
|
| + const std::string& account_id,
|
| + const GoogleServiceAuthError& error);
|
|
|
| // Add a new entry to the cache.
|
| // Subclasses can override if there are implementation-specific reasons
|
| @@ -206,7 +210,6 @@ class OAuth2TokenService : public base::NonThreadSafe {
|
| void FireRefreshTokenAvailable(const std::string& account_id);
|
| void FireRefreshTokenRevoked(const std::string& account_id);
|
| void FireRefreshTokensLoaded();
|
| - void FireRefreshTokensCleared();
|
|
|
| // Derived classes must provide a request context used for fetching access
|
| // tokens with the |StartRequest| method.
|
| @@ -215,6 +218,7 @@ class OAuth2TokenService : public base::NonThreadSafe {
|
| // Fetches an OAuth token for the specified client/scopes. Virtual so it can
|
| // be overridden for tests and for platform-specific behavior on Android.
|
| virtual void FetchOAuth2Token(RequestImpl* request,
|
| + const std::string& account_id,
|
| net::URLRequestContextGetter* getter,
|
| const std::string& client_id,
|
| const std::string& client_secret,
|
| @@ -236,6 +240,7 @@ class OAuth2TokenService : public base::NonThreadSafe {
|
| // uses |client_id| and |client_secret| to identify OAuth
|
| // client app instead of using Chrome's default values.
|
| scoped_ptr<Request> StartRequestForClientWithContext(
|
| + const std::string& account_id,
|
| net::URLRequestContextGetter* getter,
|
| const std::string& client_id,
|
| const std::string& client_secret,
|
|
|