OLD | NEW |
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 <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "content/public/browser/notification_observer.h" | 31 #include "content/public/browser/notification_observer.h" |
32 #include "content/public/browser/notification_registrar.h" | 32 #include "content/public/browser/notification_registrar.h" |
33 #include "content/public/browser/notification_types.h" | 33 #include "content/public/browser/notification_types.h" |
34 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
35 #include "sync/internal_api/public/base/model_type.h" | 35 #include "sync/internal_api/public/base/model_type.h" |
36 #include "sync/internal_api/public/engine/model_safe_worker.h" | 36 #include "sync/internal_api/public/engine/model_safe_worker.h" |
37 #include "sync/internal_api/public/sync_manager_factory.h" | 37 #include "sync/internal_api/public/sync_manager_factory.h" |
38 #include "sync/internal_api/public/util/experiments.h" | 38 #include "sync/internal_api/public/util/experiments.h" |
39 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 39 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
40 #include "sync/js/sync_js_controller.h" | 40 #include "sync/js/sync_js_controller.h" |
| 41 #include "sync/notifier/sync_notifier_helper.h" |
41 | 42 |
42 class Profile; | 43 class Profile; |
43 class ProfileSyncComponentsFactory; | 44 class ProfileSyncComponentsFactory; |
44 class SigninManager; | 45 class SigninManager; |
45 class SyncGlobalError; | 46 class SyncGlobalError; |
46 | 47 |
47 namespace browser_sync { | 48 namespace browser_sync { |
48 class BackendMigrator; | 49 class BackendMigrator; |
49 class ChangeProcessor; | 50 class ChangeProcessor; |
50 class DataTypeManager; | 51 class DataTypeManager; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 void GetDataTypeControllerStates( | 247 void GetDataTypeControllerStates( |
247 browser_sync::DataTypeController::StateMap* state_map) const; | 248 browser_sync::DataTypeController::StateMap* state_map) const; |
248 | 249 |
249 // Disables sync for user. Use ShowLoginDialog to enable. | 250 // Disables sync for user. Use ShowLoginDialog to enable. |
250 virtual void DisableForUser(); | 251 virtual void DisableForUser(); |
251 | 252 |
252 // Whether sync is enabled by user or not. | 253 // Whether sync is enabled by user or not. |
253 virtual bool HasSyncSetupCompleted() const; | 254 virtual bool HasSyncSetupCompleted() const; |
254 virtual void SetSyncSetupCompleted(); | 255 virtual void SetSyncSetupCompleted(); |
255 | 256 |
| 257 // syncer::SyncNotifier implementation (via SyncFrontend). |
| 258 virtual void OnNotificationsEnabled() OVERRIDE; |
| 259 virtual void OnNotificationsDisabled( |
| 260 syncer::NotificationsDisabledReason reason) OVERRIDE; |
| 261 virtual void OnIncomingNotification( |
| 262 const syncer::ObjectIdPayloadMap& id_payloads, |
| 263 syncer::IncomingNotificationSource source) OVERRIDE; |
| 264 |
256 // SyncFrontend implementation. | 265 // SyncFrontend implementation. |
257 virtual void OnBackendInitialized( | 266 virtual void OnBackendInitialized( |
258 const syncer::WeakHandle<syncer::JsBackend>& js_backend, | 267 const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
259 bool success) OVERRIDE; | 268 bool success) OVERRIDE; |
260 virtual void OnSyncCycleCompleted() OVERRIDE; | 269 virtual void OnSyncCycleCompleted() OVERRIDE; |
261 virtual void OnSyncConfigureRetry() OVERRIDE; | 270 virtual void OnSyncConfigureRetry() OVERRIDE; |
262 virtual void OnConnectionStatusChange( | 271 virtual void OnConnectionStatusChange( |
263 syncer::ConnectionStatus status) OVERRIDE; | 272 syncer::ConnectionStatus status) OVERRIDE; |
264 virtual void OnStopSyncingPermanently() OVERRIDE; | 273 virtual void OnStopSyncingPermanently() OVERRIDE; |
265 virtual void OnPassphraseRequired( | 274 virtual void OnPassphraseRequired( |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return configure_status_; | 544 return configure_status_; |
536 } | 545 } |
537 | 546 |
538 // If true, the ProfileSyncService has detected that a new GAIA signin has | 547 // If true, the ProfileSyncService has detected that a new GAIA signin has |
539 // succeeded, and is waiting for initialization to complete. This is used by | 548 // succeeded, and is waiting for initialization to complete. This is used by |
540 // the UI to differentiate between a new auth error (encountered as part of | 549 // the UI to differentiate between a new auth error (encountered as part of |
541 // the initialization process) and a pre-existing auth error that just hasn't | 550 // the initialization process) and a pre-existing auth error that just hasn't |
542 // been cleared yet. Virtual for testing purposes. | 551 // been cleared yet. Virtual for testing purposes. |
543 virtual bool waiting_for_auth() const; | 552 virtual bool waiting_for_auth() const; |
544 | 553 |
| 554 // Updates the set of ObjectIds associated with a given |
| 555 // |handler|. Passing an empty ObjectIdSet will unregister |
| 556 // |handler|. There should be at most one handler registered per |
| 557 // object id. |
| 558 // |
| 559 // The handler -> registered ids map is persisted across restarts of |
| 560 // sync. |
| 561 void UpdateRegisteredInvalidationIds(syncer::SyncNotifierObserver* handler, |
| 562 const syncer::ObjectIdSet& ids); |
| 563 |
545 // ProfileKeyedService implementation. | 564 // ProfileKeyedService implementation. |
546 virtual void Shutdown() OVERRIDE; | 565 virtual void Shutdown() OVERRIDE; |
547 | 566 |
548 protected: | 567 protected: |
549 // Used by test classes that derive from ProfileSyncService. | 568 // Used by test classes that derive from ProfileSyncService. |
550 virtual browser_sync::SyncBackendHost* GetBackendForTest(); | 569 virtual browser_sync::SyncBackendHost* GetBackendForTest(); |
551 | 570 |
552 // Helper to install and configure a data type manager. | 571 // Helper to install and configure a data type manager. |
553 void ConfigureDataTypeManager(); | 572 void ConfigureDataTypeManager(); |
554 | 573 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 // If |true|, there is setup UI visible so we should not start downloading | 828 // If |true|, there is setup UI visible so we should not start downloading |
810 // data types. | 829 // data types. |
811 bool setup_in_progress_; | 830 bool setup_in_progress_; |
812 | 831 |
813 // The set of currently enabled sync experiments. | 832 // The set of currently enabled sync experiments. |
814 syncer::Experiments current_experiments; | 833 syncer::Experiments current_experiments; |
815 | 834 |
816 // Factory the backend will use to build the SyncManager. | 835 // Factory the backend will use to build the SyncManager. |
817 syncer::SyncManagerFactory sync_manager_factory_; | 836 syncer::SyncManagerFactory sync_manager_factory_; |
818 | 837 |
| 838 // The set of all registered IDs. |
| 839 syncer::ObjectIdSet all_registered_ids_; |
| 840 |
| 841 // Dispatches invalidations to handlers. |
| 842 syncer::SyncNotifierHelper notifier_helper_; |
| 843 |
819 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 844 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
820 }; | 845 }; |
821 | 846 |
822 bool ShouldShowActionOnUI( | 847 bool ShouldShowActionOnUI( |
823 const syncer::SyncProtocolError& error); | 848 const syncer::SyncProtocolError& error); |
824 | 849 |
825 | 850 |
826 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 851 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |