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

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

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
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 1d335ccd801488af56bf3c4ae6a1f21be7ca5618..d91faf8ca8f3a046f713ffa5b5938c0f75cb6f70 100644
--- a/chrome/browser/signin/oauth2_token_service.h
+++ b/chrome/browser/signin/oauth2_token_service.h
@@ -76,8 +76,6 @@ class OAuth2TokenService {
// 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
@@ -91,8 +89,6 @@ class OAuth2TokenService {
// 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() {}
};
@@ -113,13 +109,15 @@ class OAuth2TokenService {
// |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.
- 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.
virtual scoped_ptr<Request> StartRequestForClient(
+ const std::string& account_id,
const std::string& client_id,
const std::string& client_secret,
const ScopeSet& scopes,
@@ -129,13 +127,14 @@ class OAuth2TokenService {
// context given by |getter| instead of using the one returned by
// |GetRequestContext| implemented by derived classes.
virtual scoped_ptr<Request> StartRequestWithContext(
+ const std::string& account_id,
net::URLRequestContextGetter* getter,
const ScopeSet& scopes,
Consumer* consumer);
// 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.,
@@ -171,7 +170,7 @@ class OAuth2TokenService {
// 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);
@@ -206,7 +205,6 @@ class OAuth2TokenService {
void FireRefreshTokenAvailable(const std::string& account_id);
void FireRefreshTokenRevoked(const std::string& account_id);
void FireRefreshTokensLoaded();
- void FireRefreshTokensCleared();
private:
// Derived classes must provide a request context used for fetching access
@@ -228,6 +226,7 @@ class OAuth2TokenService {
// 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,

Powered by Google App Engine
This is Rietveld 408576698