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

Side by Side Diff: components/browser_sync/profile_sync_service.h

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Rebase. Created 4 years, 2 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 COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 5 #ifndef COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
6 #define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 6 #define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "components/sync/js/sync_js_controller.h" 51 #include "components/sync/js/sync_js_controller.h"
52 #include "components/version_info/version_info.h" 52 #include "components/version_info/version_info.h"
53 #include "google_apis/gaia/google_service_auth_error.h" 53 #include "google_apis/gaia/google_service_auth_error.h"
54 #include "google_apis/gaia/oauth2_token_service.h" 54 #include "google_apis/gaia/oauth2_token_service.h"
55 #include "net/base/backoff_entry.h" 55 #include "net/base/backoff_entry.h"
56 #include "url/gurl.h" 56 #include "url/gurl.h"
57 57
58 class Profile; 58 class Profile;
59 class ProfileOAuth2TokenService; 59 class ProfileOAuth2TokenService;
60 class SigninManagerWrapper; 60 class SigninManagerWrapper;
61 class SyncErrorController;
62 class SyncTypePreferenceProvider;
63 61
64 namespace sync_driver { 62 namespace sync_pb {
65 class DataTypeManager; 63 class EncryptedData;
66 class DeviceInfoSyncService; 64 } // namespace sync_pb
67 class DeviceInfoTracker;
68 class LocalDeviceInfoProvider;
69 class SyncApiComponentFactory;
70 class SyncClient;
71 } // namespace sync_driver
72
73 namespace sync_driver_v2 {
74 class DeviceInfoService;
75 }
76 65
77 namespace sync_sessions { 66 namespace sync_sessions {
78 class FaviconCache; 67 class FaviconCache;
79 class OpenTabsUIDelegate; 68 class OpenTabsUIDelegate;
80 class SessionsSyncManager; 69 class SessionsSyncManager;
81 } // namespace sync_sessions 70 } // namespace sync_sessions
82 71
83 namespace syncer { 72 namespace syncer {
73 class BackendMigrator;
84 class BaseTransaction; 74 class BaseTransaction;
75 class DataTypeManager;
76 class DeviceInfoService;
77 class DeviceInfoSyncService;
78 class DeviceInfoTracker;
79 class LocalDeviceInfoProvider;
85 class NetworkResources; 80 class NetworkResources;
81 class SyncApiComponentFactory;
82 class SyncClient;
83 class SyncErrorController;
84 class SyncTypePreferenceProvider;
86 class TypeDebugInfoObserver; 85 class TypeDebugInfoObserver;
87 struct CommitCounters; 86 struct CommitCounters;
88 struct StatusCounters; 87 struct StatusCounters;
89 struct SyncCredentials; 88 struct SyncCredentials;
90 struct UpdateCounters; 89 struct UpdateCounters;
91 struct UserShare; 90 struct UserShare;
92 } // namespace syncer 91 } // namespace syncer
93 92
94 namespace sync_pb {
95 class EncryptedData;
96 } // namespace sync_pb
97
98 namespace browser_sync { 93 namespace browser_sync {
99 94
100 class BackendMigrator;
101
102 // ProfileSyncService is the layer between browser subsystems like bookmarks, 95 // ProfileSyncService is the layer between browser subsystems like bookmarks,
103 // and the sync backend. Each subsystem is logically thought of as being 96 // and the sync backend. Each subsystem is logically thought of as being
104 // a sync datatype. 97 // a sync datatype.
105 // 98 //
106 // Individual datatypes can, at any point, be in a variety of stages of being 99 // Individual datatypes can, at any point, be in a variety of stages of being
107 // "enabled". Here are some specific terms for concepts used in this class: 100 // "enabled". Here are some specific terms for concepts used in this class:
108 // 101 //
109 // 'Registered' (feature suppression for a datatype) 102 // 'Registered' (feature suppression for a datatype)
110 // 103 //
111 // When a datatype is registered, the user has the option of syncing it. 104 // When a datatype is registered, the user has the option of syncing it.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // * GetSetupInProgressHandle() 164 // * GetSetupInProgressHandle()
172 // 165 //
173 // SetFirstSetupComplete() should be called once the user has finished setting 166 // SetFirstSetupComplete() should be called once the user has finished setting
174 // up sync at least once on their account. GetSetupInProgressHandle() should 167 // up sync at least once on their account. GetSetupInProgressHandle() should
175 // be called while the user is actively configuring their account. The handle 168 // be called while the user is actively configuring their account. The handle
176 // should be deleted once configuration is complete. 169 // should be deleted once configuration is complete.
177 // 170 //
178 // Once first setup has completed and there are no outstanding 171 // Once first setup has completed and there are no outstanding
179 // setup-in-progress handles, CanConfigureDataTypes() will return true and 172 // setup-in-progress handles, CanConfigureDataTypes() will return true and
180 // datatype configuration can begin. 173 // datatype configuration can begin.
181 class ProfileSyncService : public sync_driver::SyncService, 174 class ProfileSyncService : public syncer::SyncService,
182 public sync_driver::SyncFrontend, 175 public syncer::SyncFrontend,
183 public sync_driver::SyncPrefObserver, 176 public syncer::SyncPrefObserver,
184 public sync_driver::DataTypeManagerObserver, 177 public syncer::DataTypeManagerObserver,
185 public syncer::UnrecoverableErrorHandler, 178 public syncer::UnrecoverableErrorHandler,
186 public KeyedService, 179 public KeyedService,
187 public OAuth2TokenService::Consumer, 180 public OAuth2TokenService::Consumer,
188 public OAuth2TokenService::Observer, 181 public OAuth2TokenService::Observer,
189 public SigninManagerBase::Observer, 182 public SigninManagerBase::Observer,
190 public GaiaCookieManagerService::Observer { 183 public GaiaCookieManagerService::Observer {
191 public: 184 public:
192 typedef SyncBackendHost::Status Status; 185 typedef syncer::SyncBackendHost::Status Status;
193 typedef base::Callback<bool(void)> PlatformSyncAllowedProvider; 186 typedef base::Callback<bool(void)> PlatformSyncAllowedProvider;
194 187
195 enum SyncEventCodes { 188 enum SyncEventCodes {
196 MIN_SYNC_EVENT_CODE = 0, 189 MIN_SYNC_EVENT_CODE = 0,
197 190
198 // Events starting the sync service. 191 // Events starting the sync service.
199 START_FROM_NTP = 1, // Sync was started from the ad in NTP 192 START_FROM_NTP = 1, // Sync was started from the ad in NTP
200 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. 193 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu.
201 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options. 194 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options.
202 START_FROM_BOOKMARK_MANAGER = 4, // Sync was started from Bookmark manager. 195 START_FROM_BOOKMARK_MANAGER = 4, // Sync was started from Bookmark manager.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 229
237 // Bundles the arguments for ProfileSyncService construction. This is a 230 // Bundles the arguments for ProfileSyncService construction. This is a
238 // movable struct. Because of the non-POD data members, it needs out-of-line 231 // movable struct. Because of the non-POD data members, it needs out-of-line
239 // constructors, so in particular the move constructor needs to be 232 // constructors, so in particular the move constructor needs to be
240 // explicitly defined. 233 // explicitly defined.
241 struct InitParams { 234 struct InitParams {
242 InitParams(); 235 InitParams();
243 ~InitParams(); 236 ~InitParams();
244 InitParams(InitParams&& other); // NOLINT 237 InitParams(InitParams&& other); // NOLINT
245 238
246 std::unique_ptr<sync_driver::SyncClient> sync_client; 239 std::unique_ptr<syncer::SyncClient> sync_client;
247 std::unique_ptr<SigninManagerWrapper> signin_wrapper; 240 std::unique_ptr<SigninManagerWrapper> signin_wrapper;
248 ProfileOAuth2TokenService* oauth2_token_service = nullptr; 241 ProfileOAuth2TokenService* oauth2_token_service = nullptr;
249 GaiaCookieManagerService* gaia_cookie_manager_service = nullptr; 242 GaiaCookieManagerService* gaia_cookie_manager_service = nullptr;
250 StartBehavior start_behavior = MANUAL_START; 243 StartBehavior start_behavior = MANUAL_START;
251 syncer::NetworkTimeUpdateCallback network_time_update_callback; 244 syncer::NetworkTimeUpdateCallback network_time_update_callback;
252 base::FilePath base_directory; 245 base::FilePath base_directory;
253 scoped_refptr<net::URLRequestContextGetter> url_request_context; 246 scoped_refptr<net::URLRequestContextGetter> url_request_context;
254 std::string debug_identifier; 247 std::string debug_identifier;
255 version_info::Channel channel = version_info::Channel::UNKNOWN; 248 version_info::Channel channel = version_info::Channel::UNKNOWN;
256 scoped_refptr<base::SingleThreadTaskRunner> db_thread; 249 scoped_refptr<base::SingleThreadTaskRunner> db_thread;
257 scoped_refptr<base::SingleThreadTaskRunner> file_thread; 250 scoped_refptr<base::SingleThreadTaskRunner> file_thread;
258 base::SequencedWorkerPool* blocking_pool = nullptr; 251 base::SequencedWorkerPool* blocking_pool = nullptr;
259 252
260 private: 253 private:
261 DISALLOW_COPY_AND_ASSIGN(InitParams); 254 DISALLOW_COPY_AND_ASSIGN(InitParams);
262 }; 255 };
263 256
264 explicit ProfileSyncService(InitParams init_params); 257 explicit ProfileSyncService(InitParams init_params);
265 258
266 ~ProfileSyncService() override; 259 ~ProfileSyncService() override;
267 260
268 // Initializes the object. This must be called at most once, and 261 // Initializes the object. This must be called at most once, and
269 // immediately after an object of this class is constructed. 262 // immediately after an object of this class is constructed.
270 void Initialize(); 263 void Initialize();
271 264
272 // sync_driver::SyncService implementation 265 // syncer::SyncService implementation
273 bool IsFirstSetupComplete() const override; 266 bool IsFirstSetupComplete() const override;
274 bool IsSyncAllowed() const override; 267 bool IsSyncAllowed() const override;
275 bool IsSyncActive() const override; 268 bool IsSyncActive() const override;
276 void TriggerRefresh(const syncer::ModelTypeSet& types) override; 269 void TriggerRefresh(const syncer::ModelTypeSet& types) override;
277 void OnDataTypeRequestsSyncStartup(syncer::ModelType type) override; 270 void OnDataTypeRequestsSyncStartup(syncer::ModelType type) override;
278 bool CanSyncStart() const override; 271 bool CanSyncStart() const override;
279 void RequestStop(SyncStopDataFate data_fate) override; 272 void RequestStop(SyncStopDataFate data_fate) override;
280 void RequestStart() override; 273 void RequestStart() override;
281 syncer::ModelTypeSet GetActiveDataTypes() const override; 274 syncer::ModelTypeSet GetActiveDataTypes() const override;
282 sync_driver::SyncClient* GetSyncClient() const override; 275 syncer::SyncClient* GetSyncClient() const override;
283 syncer::ModelTypeSet GetPreferredDataTypes() const override; 276 syncer::ModelTypeSet GetPreferredDataTypes() const override;
284 void OnUserChoseDatatypes(bool sync_everything, 277 void OnUserChoseDatatypes(bool sync_everything,
285 syncer::ModelTypeSet chosen_types) override; 278 syncer::ModelTypeSet chosen_types) override;
286 void SetFirstSetupComplete() override; 279 void SetFirstSetupComplete() override;
287 bool IsFirstSetupInProgress() const override; 280 bool IsFirstSetupInProgress() const override;
288 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> 281 std::unique_ptr<syncer::SyncSetupInProgressHandle> GetSetupInProgressHandle()
289 GetSetupInProgressHandle() override; 282 override;
290 bool IsSetupInProgress() const override; 283 bool IsSetupInProgress() const override;
291 bool ConfigurationDone() const override; 284 bool ConfigurationDone() const override;
292 const GoogleServiceAuthError& GetAuthError() const override; 285 const GoogleServiceAuthError& GetAuthError() const override;
293 bool HasUnrecoverableError() const override; 286 bool HasUnrecoverableError() const override;
294 bool IsBackendInitialized() const override; 287 bool IsBackendInitialized() const override;
295 sync_sessions::OpenTabsUIDelegate* GetOpenTabsUIDelegate() override; 288 sync_sessions::OpenTabsUIDelegate* GetOpenTabsUIDelegate() override;
296 bool IsPassphraseRequiredForDecryption() const override; 289 bool IsPassphraseRequiredForDecryption() const override;
297 base::Time GetExplicitPassphraseTime() const override; 290 base::Time GetExplicitPassphraseTime() const override;
298 bool IsUsingSecondaryPassphrase() const override; 291 bool IsUsingSecondaryPassphrase() const override;
299 void EnableEncryptEverything() override; 292 void EnableEncryptEverything() override;
300 bool IsEncryptEverythingEnabled() const override; 293 bool IsEncryptEverythingEnabled() const override;
301 void SetEncryptionPassphrase(const std::string& passphrase, 294 void SetEncryptionPassphrase(const std::string& passphrase,
302 PassphraseType type) override; 295 PassphraseType type) override;
303 bool SetDecryptionPassphrase(const std::string& passphrase) override 296 bool SetDecryptionPassphrase(const std::string& passphrase) override
304 WARN_UNUSED_RESULT; 297 WARN_UNUSED_RESULT;
305 bool IsCryptographerReady( 298 bool IsCryptographerReady(
306 const syncer::BaseTransaction* trans) const override; 299 const syncer::BaseTransaction* trans) const override;
307 syncer::UserShare* GetUserShare() const override; 300 syncer::UserShare* GetUserShare() const override;
308 sync_driver::LocalDeviceInfoProvider* GetLocalDeviceInfoProvider() 301 syncer::LocalDeviceInfoProvider* GetLocalDeviceInfoProvider() const override;
309 const override; 302 void AddObserver(syncer::SyncServiceObserver* observer) override;
310 void AddObserver(sync_driver::SyncServiceObserver* observer) override; 303 void RemoveObserver(syncer::SyncServiceObserver* observer) override;
311 void RemoveObserver(sync_driver::SyncServiceObserver* observer) override; 304 bool HasObserver(const syncer::SyncServiceObserver* observer) const override;
312 bool HasObserver( 305 void RegisterDataTypeController(std::unique_ptr<syncer::DataTypeController>
313 const sync_driver::SyncServiceObserver* observer) const override; 306 data_type_controller) override;
314 void RegisterDataTypeController(
315 std::unique_ptr<sync_driver::DataTypeController> data_type_controller)
316 override;
317 void ReenableDatatype(syncer::ModelType type) override; 307 void ReenableDatatype(syncer::ModelType type) override;
318 SyncTokenStatus GetSyncTokenStatus() const override; 308 SyncTokenStatus GetSyncTokenStatus() const override;
319 std::string QuerySyncStatusSummaryString() override; 309 std::string QuerySyncStatusSummaryString() override;
320 bool QueryDetailedSyncStatus(syncer::SyncStatus* result) override; 310 bool QueryDetailedSyncStatus(syncer::SyncStatus* result) override;
321 base::string16 GetLastSyncedTimeString() const override; 311 base::string16 GetLastSyncedTimeString() const override;
322 std::string GetBackendInitializationStateString() const override; 312 std::string GetBackendInitializationStateString() const override;
323 syncer::SyncCycleSnapshot GetLastCycleSnapshot() const override; 313 syncer::SyncCycleSnapshot GetLastCycleSnapshot() const override;
324 base::Value* GetTypeStatusMap() const override; 314 base::Value* GetTypeStatusMap() const override;
325 const GURL& sync_service_url() const override; 315 const GURL& sync_service_url() const override;
326 std::string unrecoverable_error_message() const override; 316 std::string unrecoverable_error_message() const override;
327 tracked_objects::Location unrecoverable_error_location() const override; 317 tracked_objects::Location unrecoverable_error_location() const override;
328 void AddProtocolEventObserver(ProtocolEventObserver* observer) override; 318 void AddProtocolEventObserver(
329 void RemoveProtocolEventObserver(ProtocolEventObserver* observer) override; 319 syncer::ProtocolEventObserver* observer) override;
320 void RemoveProtocolEventObserver(
321 syncer::ProtocolEventObserver* observer) override;
330 void AddTypeDebugInfoObserver( 322 void AddTypeDebugInfoObserver(
331 syncer::TypeDebugInfoObserver* observer) override; 323 syncer::TypeDebugInfoObserver* observer) override;
332 void RemoveTypeDebugInfoObserver( 324 void RemoveTypeDebugInfoObserver(
333 syncer::TypeDebugInfoObserver* observer) override; 325 syncer::TypeDebugInfoObserver* observer) override;
334 base::WeakPtr<syncer::JsController> GetJsController() override; 326 base::WeakPtr<syncer::JsController> GetJsController() override;
335 void GetAllNodes(const base::Callback<void(std::unique_ptr<base::ListValue>)>& 327 void GetAllNodes(const base::Callback<void(std::unique_ptr<base::ListValue>)>&
336 callback) override; 328 callback) override;
337 329
338 // Add a sync type preference provider. Each provider may only be added once. 330 // Add a sync type preference provider. Each provider may only be added once.
339 void AddPreferenceProvider(SyncTypePreferenceProvider* provider); 331 void AddPreferenceProvider(syncer::SyncTypePreferenceProvider* provider);
340 // Remove a sync type preference provider. May only be called for providers 332 // Remove a sync type preference provider. May only be called for providers
341 // that have been added. Providers must not remove themselves while being 333 // that have been added. Providers must not remove themselves while being
342 // called back. 334 // called back.
343 void RemovePreferenceProvider(SyncTypePreferenceProvider* provider); 335 void RemovePreferenceProvider(syncer::SyncTypePreferenceProvider* provider);
344 // Check whether a given sync type preference provider has been added. 336 // Check whether a given sync type preference provider has been added.
345 bool HasPreferenceProvider(SyncTypePreferenceProvider* provider) const; 337 bool HasPreferenceProvider(
338 syncer::SyncTypePreferenceProvider* provider) const;
346 339
347 void RegisterAuthNotifications(); 340 void RegisterAuthNotifications();
348 void UnregisterAuthNotifications(); 341 void UnregisterAuthNotifications();
349 342
350 // Returns the SyncableService for syncer::SESSIONS. 343 // Returns the SyncableService for syncer::SESSIONS.
351 virtual syncer::SyncableService* GetSessionsSyncableService(); 344 virtual syncer::SyncableService* GetSessionsSyncableService();
352 345
353 // Returns the SyncableService for syncer::DEVICE_INFO. 346 // Returns the SyncableService for syncer::DEVICE_INFO.
354 virtual syncer::SyncableService* GetDeviceInfoSyncableService(); 347 virtual syncer::SyncableService* GetDeviceInfoSyncableService();
355 348
356 // Returns the ModelTypeService for syncer::DEVICE_INFO. 349 // Returns the ModelTypeService for syncer::DEVICE_INFO.
357 virtual syncer_v2::ModelTypeService* GetDeviceInfoService(); 350 virtual syncer::ModelTypeService* GetDeviceInfoService();
358 351
359 // Returns synced devices tracker. 352 // Returns synced devices tracker.
360 virtual sync_driver::DeviceInfoTracker* GetDeviceInfoTracker() const; 353 virtual syncer::DeviceInfoTracker* GetDeviceInfoTracker() const;
361 354
362 // Fills state_map with a map of current data types that are possible to 355 // Fills state_map with a map of current data types that are possible to
363 // sync, as well as their states. 356 // sync, as well as their states.
364 void GetDataTypeControllerStates( 357 void GetDataTypeControllerStates(
365 sync_driver::DataTypeController::StateMap* state_map) const; 358 syncer::DataTypeController::StateMap* state_map) const;
366 359
367 // Called when asynchronous session restore has completed. 360 // Called when asynchronous session restore has completed.
368 void OnSessionRestoreComplete(); 361 void OnSessionRestoreComplete();
369 362
370 // SyncFrontend implementation. 363 // SyncFrontend implementation.
371 void OnBackendInitialized( 364 void OnBackendInitialized(
372 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 365 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
373 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 366 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
374 debug_info_listener, 367 debug_info_listener,
375 const std::string& cache_guid, 368 const std::string& cache_guid,
(...skipping 18 matching lines...) Expand all
394 bool encrypt_everything) override; 387 bool encrypt_everything) override;
395 void OnEncryptionComplete() override; 388 void OnEncryptionComplete() override;
396 void OnMigrationNeededForTypes(syncer::ModelTypeSet types) override; 389 void OnMigrationNeededForTypes(syncer::ModelTypeSet types) override;
397 void OnExperimentsChanged(const syncer::Experiments& experiments) override; 390 void OnExperimentsChanged(const syncer::Experiments& experiments) override;
398 void OnActionableError(const syncer::SyncProtocolError& error) override; 391 void OnActionableError(const syncer::SyncProtocolError& error) override;
399 void OnLocalSetPassphraseEncryption( 392 void OnLocalSetPassphraseEncryption(
400 const syncer::SyncEncryptionHandler::NigoriState& nigori_state) override; 393 const syncer::SyncEncryptionHandler::NigoriState& nigori_state) override;
401 394
402 // DataTypeManagerObserver implementation. 395 // DataTypeManagerObserver implementation.
403 void OnConfigureDone( 396 void OnConfigureDone(
404 const sync_driver::DataTypeManager::ConfigureResult& result) override; 397 const syncer::DataTypeManager::ConfigureResult& result) override;
405 void OnConfigureStart() override; 398 void OnConfigureStart() override;
406 399
407 // DataTypeEncryptionHandler implementation. 400 // DataTypeEncryptionHandler implementation.
408 bool IsPassphraseRequired() const override; 401 bool IsPassphraseRequired() const override;
409 syncer::ModelTypeSet GetEncryptedDataTypes() const override; 402 syncer::ModelTypeSet GetEncryptedDataTypes() const override;
410 403
411 // SigninManagerBase::Observer implementation. 404 // SigninManagerBase::Observer implementation.
412 void GoogleSigninSucceeded(const std::string& account_id, 405 void GoogleSigninSucceeded(const std::string& account_id,
413 const std::string& username, 406 const std::string& username,
414 const std::string& password) override; 407 const std::string& password) override;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 // TODO(akalin): These two functions are used only by 463 // TODO(akalin): These two functions are used only by
471 // ProfileSyncServiceHarness. Figure out a different way to expose 464 // ProfileSyncServiceHarness. Figure out a different way to expose
472 // this info to that class, and remove these functions. 465 // this info to that class, and remove these functions.
473 466
474 // Returns whether or not the underlying sync engine has made any 467 // Returns whether or not the underlying sync engine has made any
475 // local changes to items that have not yet been synced with the 468 // local changes to items that have not yet been synced with the
476 // server. 469 // server.
477 bool HasUnsyncedItems() const; 470 bool HasUnsyncedItems() const;
478 471
479 // Used by ProfileSyncServiceHarness. May return NULL. 472 // Used by ProfileSyncServiceHarness. May return NULL.
480 BackendMigrator* GetBackendMigratorForTest(); 473 syncer::BackendMigrator* GetBackendMigratorForTest();
481 474
482 // Used by tests to inspect interaction with OAuth2TokenService. 475 // Used by tests to inspect interaction with OAuth2TokenService.
483 bool IsRetryingAccessTokenFetchForTest() const; 476 bool IsRetryingAccessTokenFetchForTest() const;
484 477
485 // Used by tests to inspect the OAuth2 access tokens used by PSS. 478 // Used by tests to inspect the OAuth2 access tokens used by PSS.
486 std::string GetAccessTokenForTest() const; 479 std::string GetAccessTokenForTest() const;
487 480
488 // TODO(sync): This is only used in tests. Can we remove it? 481 // TODO(sync): This is only used in tests. Can we remove it?
489 void GetModelSafeRoutingInfo(syncer::ModelSafeRoutingInfo* out) const; 482 void GetModelSafeRoutingInfo(syncer::ModelSafeRoutingInfo* out) const;
490 483
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 virtual bool IsEncryptEverythingAllowed() const; 515 virtual bool IsEncryptEverythingAllowed() const;
523 516
524 // Sets whether encrypting all the sync data is allowed or not. 517 // Sets whether encrypting all the sync data is allowed or not.
525 virtual void SetEncryptEverythingAllowed(bool allowed); 518 virtual void SetEncryptEverythingAllowed(bool allowed);
526 519
527 // Returns true if the syncer is waiting for new datatypes to be encrypted. 520 // Returns true if the syncer is waiting for new datatypes to be encrypted.
528 virtual bool encryption_pending() const; 521 virtual bool encryption_pending() const;
529 522
530 SigninManagerBase* signin() const; 523 SigninManagerBase* signin() const;
531 524
532 SyncErrorController* sync_error_controller() { 525 syncer::SyncErrorController* sync_error_controller() {
533 return sync_error_controller_.get(); 526 return sync_error_controller_.get();
534 } 527 }
535 528
536 // TODO(sync): This is only used in tests. Can we remove it? 529 // TODO(sync): This is only used in tests. Can we remove it?
537 const sync_driver::DataTypeStatusTable& data_type_status_table() const; 530 const syncer::DataTypeStatusTable& data_type_status_table() const;
538 531
539 sync_driver::DataTypeManager::ConfigureStatus configure_status() { 532 syncer::DataTypeManager::ConfigureStatus configure_status() {
540 return configure_status_; 533 return configure_status_;
541 } 534 }
542 535
543 // If true, the ProfileSyncService has detected that a new GAIA signin has 536 // If true, the ProfileSyncService has detected that a new GAIA signin has
544 // succeeded, and is waiting for initialization to complete. This is used by 537 // succeeded, and is waiting for initialization to complete. This is used by
545 // the UI to differentiate between a new auth error (encountered as part of 538 // the UI to differentiate between a new auth error (encountered as part of
546 // the initialization process) and a pre-existing auth error that just hasn't 539 // the initialization process) and a pre-existing auth error that just hasn't
547 // been cleared yet. Virtual for testing purposes. 540 // been cleared yet. Virtual for testing purposes.
548 virtual bool waiting_for_auth() const; 541 virtual bool waiting_for_auth() const;
549 542
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 const std::string& message, 614 const std::string& message,
622 bool delete_sync_database); 615 bool delete_sync_database);
623 616
624 // This is a cache of the last authentication response we received from the 617 // This is a cache of the last authentication response we received from the
625 // sync server. The UI queries this to display appropriate messaging to the 618 // sync server. The UI queries this to display appropriate messaging to the
626 // user. 619 // user.
627 GoogleServiceAuthError last_auth_error_; 620 GoogleServiceAuthError last_auth_error_;
628 621
629 // Our asynchronous backend to communicate with sync components living on 622 // Our asynchronous backend to communicate with sync components living on
630 // other threads. 623 // other threads.
631 std::unique_ptr<SyncBackendHost> backend_; 624 std::unique_ptr<syncer::SyncBackendHost> backend_;
632 625
633 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it 626 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it
634 // was required for encryption, decryption with a cached passphrase, or 627 // was required for encryption, decryption with a cached passphrase, or
635 // because a new passphrase is required? 628 // because a new passphrase is required?
636 syncer::PassphraseRequiredReason passphrase_required_reason_; 629 syncer::PassphraseRequiredReason passphrase_required_reason_;
637 630
638 private: 631 private:
639 enum UnrecoverableErrorReason { 632 enum UnrecoverableErrorReason {
640 ERROR_REASON_UNSET, 633 ERROR_REASON_UNSET,
641 ERROR_REASON_SYNCER, 634 ERROR_REASON_SYNCER,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 void OnClearServerDataDone(); 788 void OnClearServerDataDone();
796 789
797 // True if setup has been completed at least once and is not in progress. 790 // True if setup has been completed at least once and is not in progress.
798 bool CanConfigureDataTypes() const; 791 bool CanConfigureDataTypes() const;
799 792
800 // Called when a SetupInProgressHandle issued by this instance is destroyed. 793 // Called when a SetupInProgressHandle issued by this instance is destroyed.
801 virtual void OnSetupInProgressHandleDestroyed(); 794 virtual void OnSetupInProgressHandleDestroyed();
802 795
803 // This profile's SyncClient, which abstracts away non-Sync dependencies and 796 // This profile's SyncClient, which abstracts away non-Sync dependencies and
804 // the Sync API component factory. 797 // the Sync API component factory.
805 std::unique_ptr<sync_driver::SyncClient> sync_client_; 798 std::unique_ptr<syncer::SyncClient> sync_client_;
806 799
807 // The class that handles getting, setting, and persisting sync 800 // The class that handles getting, setting, and persisting sync
808 // preferences. 801 // preferences.
809 sync_driver::SyncPrefs sync_prefs_; 802 syncer::SyncPrefs sync_prefs_;
810 803
811 // TODO(ncarter): Put this in a profile, once there is UI for it. 804 // TODO(ncarter): Put this in a profile, once there is UI for it.
812 // This specifies where to find the sync server. 805 // This specifies where to find the sync server.
813 const GURL sync_service_url_; 806 const GURL sync_service_url_;
814 807
815 // The time that OnConfigureStart is called. This member is zero if 808 // The time that OnConfigureStart is called. This member is zero if
816 // OnConfigureStart has not yet been called, and is reset to zero once 809 // OnConfigureStart has not yet been called, and is reset to zero once
817 // OnConfigureDone is called. 810 // OnConfigureDone is called.
818 base::Time sync_configure_start_time_; 811 base::Time sync_configure_start_time_;
819 812
(...skipping 20 matching lines...) Expand all
840 833
841 // Indicates if this is the first time sync is being configured. This value 834 // Indicates if this is the first time sync is being configured. This value
842 // is equal to !IsFirstSetupComplete() at the time of OnBackendInitialized(). 835 // is equal to !IsFirstSetupComplete() at the time of OnBackendInitialized().
843 bool is_first_time_sync_configure_; 836 bool is_first_time_sync_configure_;
844 837
845 // Number of UIs currently configuring the Sync service. When this number 838 // Number of UIs currently configuring the Sync service. When this number
846 // is decremented back to zero, Sync setup is marked no longer in progress. 839 // is decremented back to zero, Sync setup is marked no longer in progress.
847 int outstanding_setup_in_progress_handles_ = 0; 840 int outstanding_setup_in_progress_handles_ = 0;
848 841
849 // List of available data type controllers. 842 // List of available data type controllers.
850 sync_driver::DataTypeController::TypeMap data_type_controllers_; 843 syncer::DataTypeController::TypeMap data_type_controllers_;
851 844
852 // Whether the SyncBackendHost has been initialized. 845 // Whether the SyncBackendHost has been initialized.
853 bool backend_initialized_; 846 bool backend_initialized_;
854 847
855 // Set when sync receives DISABLED_BY_ADMIN error from server. Prevents 848 // Set when sync receives DISABLED_BY_ADMIN error from server. Prevents
856 // ProfileSyncService from starting backend till browser restarted or user 849 // ProfileSyncService from starting backend till browser restarted or user
857 // signed out. 850 // signed out.
858 bool sync_disabled_by_admin_; 851 bool sync_disabled_by_admin_;
859 852
860 // Set to true if a signin has completed but we're still waiting for the 853 // Set to true if a signin has completed but we're still waiting for the
861 // backend to refresh its credentials. 854 // backend to refresh its credentials.
862 bool is_auth_in_progress_; 855 bool is_auth_in_progress_;
863 856
864 // Encapsulates user signin - used to set/get the user's authenticated 857 // Encapsulates user signin - used to set/get the user's authenticated
865 // email address. 858 // email address.
866 const std::unique_ptr<SigninManagerWrapper> signin_; 859 const std::unique_ptr<SigninManagerWrapper> signin_;
867 860
868 // Information describing an unrecoverable error. 861 // Information describing an unrecoverable error.
869 UnrecoverableErrorReason unrecoverable_error_reason_; 862 UnrecoverableErrorReason unrecoverable_error_reason_;
870 std::string unrecoverable_error_message_; 863 std::string unrecoverable_error_message_;
871 tracked_objects::Location unrecoverable_error_location_; 864 tracked_objects::Location unrecoverable_error_location_;
872 865
873 // Manages the start and stop of the data types. 866 // Manages the start and stop of the data types.
874 std::unique_ptr<sync_driver::DataTypeManager> data_type_manager_; 867 std::unique_ptr<syncer::DataTypeManager> data_type_manager_;
875 868
876 base::ObserverList<sync_driver::SyncServiceObserver> observers_; 869 base::ObserverList<syncer::SyncServiceObserver> observers_;
877 base::ObserverList<ProtocolEventObserver> protocol_event_observers_; 870 base::ObserverList<syncer::ProtocolEventObserver> protocol_event_observers_;
878 base::ObserverList<syncer::TypeDebugInfoObserver> type_debug_info_observers_; 871 base::ObserverList<syncer::TypeDebugInfoObserver> type_debug_info_observers_;
879 872
880 std::set<SyncTypePreferenceProvider*> preference_providers_; 873 std::set<syncer::SyncTypePreferenceProvider*> preference_providers_;
881 874
882 syncer::SyncJsController sync_js_controller_; 875 syncer::SyncJsController sync_js_controller_;
883 876
884 // This allows us to gracefully handle an ABORTED return code from the 877 // This allows us to gracefully handle an ABORTED return code from the
885 // DataTypeManager in the event that the server informed us to cease and 878 // DataTypeManager in the event that the server informed us to cease and
886 // desist syncing immediately. 879 // desist syncing immediately.
887 bool expect_sync_configuration_aborted_; 880 bool expect_sync_configuration_aborted_;
888 881
889 // Sometimes we need to temporarily hold on to a passphrase because we don't 882 // Sometimes we need to temporarily hold on to a passphrase because we don't
890 // yet have a backend to send it to. This happens during initialization as 883 // yet have a backend to send it to. This happens during initialization as
891 // we don't StartUp until we have a valid token, which happens after valid 884 // we don't StartUp until we have a valid token, which happens after valid
892 // credentials were provided. 885 // credentials were provided.
893 std::string cached_passphrase_; 886 std::string cached_passphrase_;
894 887
895 // The current set of encrypted types. Always a superset of 888 // The current set of encrypted types. Always a superset of
896 // syncer::Cryptographer::SensitiveTypes(). 889 // syncer::Cryptographer::SensitiveTypes().
897 syncer::ModelTypeSet encrypted_types_; 890 syncer::ModelTypeSet encrypted_types_;
898 891
899 // Whether encrypting everything is allowed. 892 // Whether encrypting everything is allowed.
900 bool encrypt_everything_allowed_; 893 bool encrypt_everything_allowed_;
901 894
902 // Whether we want to encrypt everything. 895 // Whether we want to encrypt everything.
903 bool encrypt_everything_; 896 bool encrypt_everything_;
904 897
905 // Whether we're waiting for an attempt to encryption all sync data to 898 // Whether we're waiting for an attempt to encryption all sync data to
906 // complete. We track this at this layer in order to allow the user to cancel 899 // complete. We track this at this layer in order to allow the user to cancel
907 // if they e.g. don't remember their explicit passphrase. 900 // if they e.g. don't remember their explicit passphrase.
908 bool encryption_pending_; 901 bool encryption_pending_;
909 902
910 std::unique_ptr<BackendMigrator> migrator_; 903 std::unique_ptr<syncer::BackendMigrator> migrator_;
911 904
912 // This is the last |SyncProtocolError| we received from the server that had 905 // This is the last |SyncProtocolError| we received from the server that had
913 // an action set on it. 906 // an action set on it.
914 syncer::SyncProtocolError last_actionable_error_; 907 syncer::SyncProtocolError last_actionable_error_;
915 908
916 // Exposes sync errors to the UI. 909 // Exposes sync errors to the UI.
917 std::unique_ptr<SyncErrorController> sync_error_controller_; 910 std::unique_ptr<syncer::SyncErrorController> sync_error_controller_;
918 911
919 // Tracks the set of failed data types (those that encounter an error 912 // Tracks the set of failed data types (those that encounter an error
920 // or must delay loading for some reason). 913 // or must delay loading for some reason).
921 sync_driver::DataTypeStatusTable data_type_status_table_; 914 syncer::DataTypeStatusTable data_type_status_table_;
922 915
923 sync_driver::DataTypeManager::ConfigureStatus configure_status_; 916 syncer::DataTypeManager::ConfigureStatus configure_status_;
924 917
925 // The set of currently enabled sync experiments. 918 // The set of currently enabled sync experiments.
926 syncer::Experiments current_experiments_; 919 syncer::Experiments current_experiments_;
927 920
928 // Sync's internal debug info listener. Used to record datatype configuration 921 // Sync's internal debug info listener. Used to record datatype configuration
929 // and association information. 922 // and association information.
930 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; 923 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_;
931 924
932 // A thread where all the sync operations happen. 925 // A thread where all the sync operations happen.
933 // OWNERSHIP Notes: 926 // OWNERSHIP Notes:
(...skipping 23 matching lines...) Expand all
957 syncer::ConnectionStatus connection_status_; 950 syncer::ConnectionStatus connection_status_;
958 base::Time token_request_time_; 951 base::Time token_request_time_;
959 base::Time token_receive_time_; 952 base::Time token_receive_time_;
960 GoogleServiceAuthError last_get_token_error_; 953 GoogleServiceAuthError last_get_token_error_;
961 base::Time next_token_request_time_; 954 base::Time next_token_request_time_;
962 955
963 // The gaia cookie manager. Used for monitoring cookie jar changes to detect 956 // The gaia cookie manager. Used for monitoring cookie jar changes to detect
964 // when the user signs out of the content area. 957 // when the user signs out of the content area.
965 GaiaCookieManagerService* const gaia_cookie_manager_service_; 958 GaiaCookieManagerService* const gaia_cookie_manager_service_;
966 959
967 std::unique_ptr<sync_driver::LocalDeviceInfoProvider> local_device_; 960 std::unique_ptr<syncer::LocalDeviceInfoProvider> local_device_;
968 961
969 // Locally owned SyncableService and ModelTypeService implementations. 962 // Locally owned SyncableService and ModelTypeService implementations.
970 std::unique_ptr<sync_sessions::SessionsSyncManager> sessions_sync_manager_; 963 std::unique_ptr<sync_sessions::SessionsSyncManager> sessions_sync_manager_;
971 std::unique_ptr<sync_driver::DeviceInfoSyncService> device_info_sync_service_; 964 std::unique_ptr<syncer::DeviceInfoSyncService> device_info_sync_service_;
972 std::unique_ptr<sync_driver_v2::DeviceInfoService> device_info_service_; 965 std::unique_ptr<syncer::DeviceInfoService> device_info_service_;
973 966
974 std::unique_ptr<syncer::NetworkResources> network_resources_; 967 std::unique_ptr<syncer::NetworkResources> network_resources_;
975 968
976 StartBehavior start_behavior_; 969 StartBehavior start_behavior_;
977 std::unique_ptr<StartupController> startup_controller_; 970 std::unique_ptr<syncer::StartupController> startup_controller_;
978 971
979 // The full path to the sync data directory. 972 // The full path to the sync data directory.
980 base::FilePath directory_path_; 973 base::FilePath directory_path_;
981 974
982 std::unique_ptr<SyncStoppedReporter> sync_stopped_reporter_; 975 std::unique_ptr<syncer::SyncStoppedReporter> sync_stopped_reporter_;
983 976
984 // Listens for the system being under memory pressure. 977 // Listens for the system being under memory pressure.
985 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; 978 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
986 979
987 // Nigori state after user switching to custom passphrase, saved until 980 // Nigori state after user switching to custom passphrase, saved until
988 // transition steps complete. It will be injected into new backend after sync 981 // transition steps complete. It will be injected into new backend after sync
989 // restart. 982 // restart.
990 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState> 983 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>
991 saved_nigori_state_; 984 saved_nigori_state_;
992 985
(...skipping 23 matching lines...) Expand all
1016 base::WeakPtrFactory<ProfileSyncService> weak_factory_; 1009 base::WeakPtrFactory<ProfileSyncService> weak_factory_;
1017 1010
1018 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 1011 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
1019 }; 1012 };
1020 1013
1021 bool ShouldShowActionOnUI(const syncer::SyncProtocolError& error); 1014 bool ShouldShowActionOnUI(const syncer::SyncProtocolError& error);
1022 1015
1023 } // namespace browser_sync 1016 } // namespace browser_sync
1024 1017
1025 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 1018 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW
« no previous file with comments | « components/browser_sync/profile_sync_components_factory_impl.cc ('k') | components/browser_sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698