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 61b570058ee6da2a75d59a13fccc36d52264d80d..c2388adefda20d90d26dbd1a6f1266c4ed6fb51f 100644 |
--- a/chrome/browser/sync/profile_sync_service.h |
+++ b/chrome/browser/sync/profile_sync_service.h |
@@ -21,6 +21,7 @@ |
#include "base/time.h" |
#include "base/timer.h" |
#include "chrome/browser/profiles/profile_keyed_service.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 ProfileKeyedService, |
- public InvalidationFrontend { |
+ public InvalidationFrontend, |
+ public OAuth2TokenService::Consumer { |
public: |
typedef browser_sync::SyncBackendHost::Status Status; |
@@ -616,6 +618,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; |
+ |
// ProfileKeyedService implementation. This must be called exactly |
// once (before this object is destroyed). |
virtual void Shutdown() OVERRIDE; |
@@ -720,6 +729,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, |
tim (not reviewing)
2013/05/23 19:03:42
style-nit: Functions with bool parameters (especi
|
+ 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); |
@@ -936,6 +953,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); |
}; |