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

Side by Side Diff: chrome/browser/sync/profile_sync_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: Rebasing to include the update to ProfileSyncService: r224220 Created 7 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 29 matching lines...) Expand all
40 #include "google_apis/gaia/oauth2_token_service.h" 40 #include "google_apis/gaia/oauth2_token_service.h"
41 #include "net/base/backoff_entry.h" 41 #include "net/base/backoff_entry.h"
42 #include "sync/internal_api/public/base/model_type.h" 42 #include "sync/internal_api/public/base/model_type.h"
43 #include "sync/internal_api/public/engine/model_safe_worker.h" 43 #include "sync/internal_api/public/engine/model_safe_worker.h"
44 #include "sync/internal_api/public/sync_manager_factory.h" 44 #include "sync/internal_api/public/sync_manager_factory.h"
45 #include "sync/internal_api/public/util/experiments.h" 45 #include "sync/internal_api/public/util/experiments.h"
46 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" 46 #include "sync/internal_api/public/util/unrecoverable_error_handler.h"
47 #include "sync/js/sync_js_controller.h" 47 #include "sync/js/sync_js_controller.h"
48 #include "url/gurl.h" 48 #include "url/gurl.h"
49 49
50 class OAuth2TokenService; 50 class ProfileOAuth2TokenService;
51 class Profile; 51 class Profile;
52 class ProfileSyncComponentsFactory; 52 class ProfileSyncComponentsFactory;
53 class SigninManagerBase; 53 class SigninManagerBase;
54 class SyncGlobalError; 54 class SyncGlobalError;
55 55
56 namespace browser_sync { 56 namespace browser_sync {
57 class BackendMigrator; 57 class BackendMigrator;
58 class ChangeProcessor; 58 class ChangeProcessor;
59 class DataTypeManager; 59 class DataTypeManager;
60 class DeviceInfo; 60 class DeviceInfo;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 // Default sync server URL. 231 // Default sync server URL.
232 static const char* kSyncServerUrl; 232 static const char* kSyncServerUrl;
233 // Sync server URL for dev channel users 233 // Sync server URL for dev channel users
234 static const char* kDevServerUrl; 234 static const char* kDevServerUrl;
235 235
236 // Takes ownership of |factory|. 236 // Takes ownership of |factory|.
237 ProfileSyncService(ProfileSyncComponentsFactory* factory, 237 ProfileSyncService(ProfileSyncComponentsFactory* factory,
238 Profile* profile, 238 Profile* profile,
239 SigninManagerBase* signin, 239 SigninManagerBase* signin,
240 OAuth2TokenService* oauth2_token_service, 240 ProfileOAuth2TokenService* oauth2_token_service,
241 StartBehavior start_behavior); 241 StartBehavior start_behavior);
242 virtual ~ProfileSyncService(); 242 virtual ~ProfileSyncService();
243 243
244 // Initializes the object. This must be called at most once, and 244 // Initializes the object. This must be called at most once, and
245 // immediately after an object of this class is constructed. 245 // immediately after an object of this class is constructed.
246 void Initialize(); 246 void Initialize();
247 247
248 virtual void SetSyncSetupCompleted(); 248 virtual void SetSyncSetupCompleted();
249 249
250 // ProfileSyncServiceBase implementation. 250 // ProfileSyncServiceBase implementation.
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 const std::string& access_token, 630 const std::string& access_token,
631 const base::Time& expiration_time) OVERRIDE; 631 const base::Time& expiration_time) OVERRIDE;
632 virtual void OnGetTokenFailure( 632 virtual void OnGetTokenFailure(
633 const OAuth2TokenService::Request* request, 633 const OAuth2TokenService::Request* request,
634 const GoogleServiceAuthError& error) OVERRIDE; 634 const GoogleServiceAuthError& error) OVERRIDE;
635 635
636 // OAuth2TokenService::Observer implementation. 636 // OAuth2TokenService::Observer implementation.
637 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; 637 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE;
638 virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE; 638 virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE;
639 virtual void OnRefreshTokensLoaded() OVERRIDE; 639 virtual void OnRefreshTokensLoaded() OVERRIDE;
640 virtual void OnRefreshTokensCleared() OVERRIDE;
641 640
642 // BrowserContextKeyedService implementation. This must be called exactly 641 // BrowserContextKeyedService implementation. This must be called exactly
643 // once (before this object is destroyed). 642 // once (before this object is destroyed).
644 virtual void Shutdown() OVERRIDE; 643 virtual void Shutdown() OVERRIDE;
645 644
646 // Called when a datatype (SyncableService) has a need for sync to start 645 // Called when a datatype (SyncableService) has a need for sync to start
647 // ASAP, presumably because a local change event has occurred but we're 646 // ASAP, presumably because a local change event has occurred but we're
648 // still in deferred start mode, meaning the SyncableService hasn't been 647 // still in deferred start mode, meaning the SyncableService hasn't been
649 // told to MergeDataAndStartSyncing yet. 648 // told to MergeDataAndStartSyncing yet.
650 void OnDataTypeRequestsSyncStartup(syncer::ModelType type); 649 void OnDataTypeRequestsSyncStartup(syncer::ModelType type);
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 // * If sync is disabled, PSS claims ownership from backend. 949 // * If sync is disabled, PSS claims ownership from backend.
951 // * If sync is reenabled, PSS passes ownership to new backend. 950 // * If sync is reenabled, PSS passes ownership to new backend.
952 scoped_ptr<base::Thread> sync_thread_; 951 scoped_ptr<base::Thread> sync_thread_;
953 952
954 // Specifies whenever to use oauth2 access token or ClientLogin token in 953 // Specifies whenever to use oauth2 access token or ClientLogin token in
955 // communications with sync and xmpp servers. 954 // communications with sync and xmpp servers.
956 // TODO(pavely): Remove once android is converted to oauth2 tokens. 955 // TODO(pavely): Remove once android is converted to oauth2 tokens.
957 bool use_oauth2_token_; 956 bool use_oauth2_token_;
958 957
959 // ProfileSyncService uses this service to get access tokens. 958 // ProfileSyncService uses this service to get access tokens.
960 OAuth2TokenService* oauth2_token_service_; 959 ProfileOAuth2TokenService* oauth2_token_service_;
961 960
962 // ProfileSyncService needs to remember access token in order to invalidate it 961 // ProfileSyncService needs to remember access token in order to invalidate it
963 // with OAuth2TokenService. 962 // with OAuth2TokenService.
964 std::string access_token_; 963 std::string access_token_;
965 964
966 // ProfileSyncService needs to hold reference to access_token_request_ for 965 // ProfileSyncService needs to hold reference to access_token_request_ for
967 // the duration of request in order to receive callbacks. 966 // the duration of request in order to receive callbacks.
968 scoped_ptr<OAuth2TokenService::Request> access_token_request_; 967 scoped_ptr<OAuth2TokenService::Request> access_token_request_;
969 968
970 // If RequestAccessToken fails with transient error then retry requesting 969 // If RequestAccessToken fails with transient error then retry requesting
971 // access token with exponential backoff. 970 // access token with exponential backoff.
972 base::OneShotTimer<ProfileSyncService> request_access_token_retry_timer_; 971 base::OneShotTimer<ProfileSyncService> request_access_token_retry_timer_;
973 net::BackoffEntry request_access_token_backoff_; 972 net::BackoffEntry request_access_token_backoff_;
974 973
975 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 974 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
976 }; 975 };
977 976
978 bool ShouldShowActionOnUI( 977 bool ShouldShowActionOnUI(
979 const syncer::SyncProtocolError& error); 978 const syncer::SyncProtocolError& error);
980 979
981 980
982 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 981 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/signin/ubertoken_fetcher_unittest.cc ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698