| Index: chrome/browser/sync/profile_sync_service.h
|
| diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
|
| index c6ba13331a5b898d8c394dabd71c887cbae64223..4a87a72896f9bc1a1196b2e0b9a45c7e0c7f54db 100644
|
| --- a/chrome/browser/sync/profile_sync_service.h
|
| +++ b/chrome/browser/sync/profile_sync_service.h
|
| @@ -22,6 +22,7 @@
|
| #include "base/timer.h"
|
| #include "chrome/browser/invalidation/invalidation_frontend.h"
|
| #include "chrome/browser/invalidation/invalidator_storage.h"
|
| +#include "chrome/browser/signin/oauth2_token_service.h"
|
| #include "chrome/browser/signin/signin_global_error.h"
|
| #include "chrome/browser/sync/backend_unrecoverable_error_handler.h"
|
| #include "chrome/browser/sync/failed_datatypes_handler.h"
|
| @@ -162,7 +163,8 @@ class ProfileSyncService : public ProfileSyncServiceBase,
|
| public syncer::UnrecoverableErrorHandler,
|
| public content::NotificationObserver,
|
| public BrowserContextKeyedService,
|
| - public invalidation::InvalidationFrontend {
|
| + public invalidation::InvalidationFrontend,
|
| + public OAuth2TokenService::Consumer {
|
| public:
|
| typedef browser_sync::SyncBackendHost::Status Status;
|
|
|
| @@ -247,9 +249,9 @@ class ProfileSyncService : public ProfileSyncServiceBase,
|
| // Virtual to enable mocking in tests.
|
| virtual bool IsSyncEnabledAndLoggedIn();
|
|
|
| - // Return whether all sync tokens are loaded and available for the backend to
|
| - // start up. Virtual to enable mocking in tests.
|
| - virtual bool IsSyncTokenAvailable();
|
| + // Return whether OAuth2 refresh token is loaded and available for the backend
|
| + // to start up. Virtual to enable mocking in tests.
|
| + virtual bool IsOAuthRefreshTokenAvailable();
|
|
|
| // Registers a data type controller with the sync service. This
|
| // makes the data type controller available for use, it does not
|
| @@ -617,6 +619,13 @@ class ProfileSyncService : public ProfileSyncServiceBase,
|
|
|
| virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
|
|
|
| + // OAuth2TokenService::Consumer implementation
|
| + virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
|
| + const std::string& access_token,
|
| + const base::Time& expiration_time) OVERRIDE;
|
| + virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
|
| + const GoogleServiceAuthError& error) OVERRIDE;
|
| +
|
| // BrowserContextKeyedService implementation. This must be called exactly
|
| // once (before this object is destroyed).
|
| virtual void Shutdown() OVERRIDE;
|
| @@ -727,6 +736,14 @@ class ProfileSyncService : public ProfileSyncServiceBase,
|
| // cached passphrase and clear it out when it is done.
|
| void ConsumeCachedPassphraseIfPossible();
|
|
|
| + // RequestAccessToken initiates RPC to request downscoped access token from
|
| + // refresh token. This happens when TokenService loads OAuth2 login token and
|
| + // when sync server returns AUTH_ERROR which indicates it is time to refresh
|
| + // token.
|
| + virtual void RequestAccessToken(
|
| + bool invalidate_previous_token,
|
| + bool invoke_callback);
|
| +
|
| // If |delete_sync_data_folder| is true, then this method will delete all
|
| // previous "Sync Data" folders. (useful if the folder is partial/corrupt).
|
| void InitializeBackend(bool delete_sync_data_folder);
|
| @@ -944,6 +961,14 @@ class ProfileSyncService : public ProfileSyncServiceBase,
|
| // and association information.
|
| syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_;
|
|
|
| + // ProfileSyncService needs to remember access token in order to invalidate it
|
| + // with OAuth2TokenService.
|
| + std::string access_token_;
|
| +
|
| + // ProfileSyncService needs to hold reference to access_token_request_ for
|
| + // the duration of request in order to receive callbacks.
|
| + scoped_ptr<OAuth2TokenService::Request> access_token_request_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
|
| };
|
|
|
|
|