| 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 23 matching lines...) Expand all Loading... |
| 34 #include "content/public/browser/notification_registrar.h" | 34 #include "content/public/browser/notification_registrar.h" |
| 35 #include "content/public/browser/notification_types.h" | 35 #include "content/public/browser/notification_types.h" |
| 36 #include "google_apis/gaia/google_service_auth_error.h" | 36 #include "google_apis/gaia/google_service_auth_error.h" |
| 37 #include "googleurl/src/gurl.h" | 37 #include "googleurl/src/gurl.h" |
| 38 #include "sync/internal_api/public/base/model_type.h" | 38 #include "sync/internal_api/public/base/model_type.h" |
| 39 #include "sync/internal_api/public/engine/model_safe_worker.h" | 39 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 40 #include "sync/internal_api/public/sync_manager_factory.h" | 40 #include "sync/internal_api/public/sync_manager_factory.h" |
| 41 #include "sync/internal_api/public/util/experiments.h" | 41 #include "sync/internal_api/public/util/experiments.h" |
| 42 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 42 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
| 43 #include "sync/js/sync_js_controller.h" | 43 #include "sync/js/sync_js_controller.h" |
| 44 #include "sync/notifier/invalidator_registrar.h" | |
| 45 | 44 |
| 46 class Profile; | 45 class Profile; |
| 47 class ProfileSyncComponentsFactory; | 46 class ProfileSyncComponentsFactory; |
| 48 class SigninManager; | 47 class SigninManager; |
| 49 class SyncGlobalError; | 48 class SyncGlobalError; |
| 50 | 49 |
| 51 namespace browser_sync { | 50 namespace browser_sync { |
| 52 class BackendMigrator; | 51 class BackendMigrator; |
| 53 class ChangeProcessor; | 52 class ChangeProcessor; |
| 54 class DataTypeManager; | 53 class DataTypeManager; |
| 55 class JsController; | 54 class JsController; |
| 56 class SessionModelAssociator; | 55 class SessionModelAssociator; |
| 57 | 56 |
| 58 namespace sessions { class SyncSessionSnapshot; } | 57 namespace sessions { class SyncSessionSnapshot; } |
| 59 } | 58 } |
| 60 | 59 |
| 61 namespace syncer { | 60 namespace syncer { |
| 62 class BaseTransaction; | 61 class BaseTransaction; |
| 62 class InvalidatorRegistrar; |
| 63 struct SyncCredentials; | 63 struct SyncCredentials; |
| 64 struct UserShare; | 64 struct UserShare; |
| 65 } | 65 } |
| 66 | 66 |
| 67 namespace sync_pb { | 67 namespace sync_pb { |
| 68 class EncryptedData; | 68 class EncryptedData; |
| 69 } // namespace sync_pb | 69 } // namespace sync_pb |
| 70 | 70 |
| 71 // ProfileSyncService is the layer between browser subsystems like bookmarks, | 71 // ProfileSyncService is the layer between browser subsystems like bookmarks, |
| 72 // and the sync backend. Each subsystem is logically thought of as being | 72 // and the sync backend. Each subsystem is logically thought of as being |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // Sync server URL for dev channel users | 211 // Sync server URL for dev channel users |
| 212 static const char* kDevServerUrl; | 212 static const char* kDevServerUrl; |
| 213 | 213 |
| 214 // Takes ownership of |factory|. | 214 // Takes ownership of |factory|. |
| 215 ProfileSyncService(ProfileSyncComponentsFactory* factory, | 215 ProfileSyncService(ProfileSyncComponentsFactory* factory, |
| 216 Profile* profile, | 216 Profile* profile, |
| 217 SigninManager* signin, | 217 SigninManager* signin, |
| 218 StartBehavior start_behavior); | 218 StartBehavior start_behavior); |
| 219 virtual ~ProfileSyncService(); | 219 virtual ~ProfileSyncService(); |
| 220 | 220 |
| 221 // Initializes the object. This should be called every time an object of this | 221 // Initializes the object. This must be called at most once, and |
| 222 // class is constructed. | 222 // immediately after an object of this class is constructed. |
| 223 void Initialize(); | 223 void Initialize(); |
| 224 | 224 |
| 225 virtual void SetSyncSetupCompleted(); | 225 virtual void SetSyncSetupCompleted(); |
| 226 | 226 |
| 227 // ProfileSyncServiceBase implementation. | 227 // ProfileSyncServiceBase implementation. |
| 228 virtual bool HasSyncSetupCompleted() const OVERRIDE; | 228 virtual bool HasSyncSetupCompleted() const OVERRIDE; |
| 229 virtual bool ShouldPushChanges() OVERRIDE; | 229 virtual bool ShouldPushChanges() OVERRIDE; |
| 230 virtual syncer::ModelTypeSet GetPreferredDataTypes() const OVERRIDE; | 230 virtual syncer::ModelTypeSet GetPreferredDataTypes() const OVERRIDE; |
| 231 virtual void AddObserver(Observer* observer) OVERRIDE; | 231 virtual void AddObserver(Observer* observer) OVERRIDE; |
| 232 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 232 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 return configure_status_; | 545 return configure_status_; |
| 546 } | 546 } |
| 547 | 547 |
| 548 // If true, the ProfileSyncService has detected that a new GAIA signin has | 548 // If true, the ProfileSyncService has detected that a new GAIA signin has |
| 549 // succeeded, and is waiting for initialization to complete. This is used by | 549 // succeeded, and is waiting for initialization to complete. This is used by |
| 550 // the UI to differentiate between a new auth error (encountered as part of | 550 // the UI to differentiate between a new auth error (encountered as part of |
| 551 // the initialization process) and a pre-existing auth error that just hasn't | 551 // the initialization process) and a pre-existing auth error that just hasn't |
| 552 // been cleared yet. Virtual for testing purposes. | 552 // been cleared yet. Virtual for testing purposes. |
| 553 virtual bool waiting_for_auth() const; | 553 virtual bool waiting_for_auth() const; |
| 554 | 554 |
| 555 // InvalidationFrontend implementation. | 555 // InvalidationFrontend implementation. It is an error to have |
| 556 // registered handlers when Shutdown() is called. |
| 556 virtual void RegisterInvalidationHandler( | 557 virtual void RegisterInvalidationHandler( |
| 557 syncer::InvalidationHandler* handler) OVERRIDE; | 558 syncer::InvalidationHandler* handler) OVERRIDE; |
| 558 virtual void UpdateRegisteredInvalidationIds( | 559 virtual void UpdateRegisteredInvalidationIds( |
| 559 syncer::InvalidationHandler* handler, | 560 syncer::InvalidationHandler* handler, |
| 560 const syncer::ObjectIdSet& ids) OVERRIDE; | 561 const syncer::ObjectIdSet& ids) OVERRIDE; |
| 561 virtual void UnregisterInvalidationHandler( | 562 virtual void UnregisterInvalidationHandler( |
| 562 syncer::InvalidationHandler* handler) OVERRIDE; | 563 syncer::InvalidationHandler* handler) OVERRIDE; |
| 563 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; | 564 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; |
| 564 | 565 |
| 565 // ProfileKeyedService implementation. | 566 // ProfileKeyedService implementation. This must be called exactly |
| 567 // once (before this object is destroyed). |
| 566 virtual void Shutdown() OVERRIDE; | 568 virtual void Shutdown() OVERRIDE; |
| 567 | 569 |
| 568 // Simulate an incoming notification for the given id and payload. | 570 // Simulate an incoming notification for the given id and payload. |
| 569 void EmitInvalidationForTest( | 571 void EmitInvalidationForTest( |
| 570 const invalidation::ObjectId& id, | 572 const invalidation::ObjectId& id, |
| 571 const std::string& payload); | 573 const std::string& payload); |
| 572 | 574 |
| 573 protected: | 575 protected: |
| 574 // Used by test classes that derive from ProfileSyncService. | 576 // Used by test classes that derive from ProfileSyncService. |
| 575 virtual browser_sync::SyncBackendHost* GetBackendForTest(); | 577 virtual browser_sync::SyncBackendHost* GetBackendForTest(); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 // If |true|, there is setup UI visible so we should not start downloading | 836 // If |true|, there is setup UI visible so we should not start downloading |
| 835 // data types. | 837 // data types. |
| 836 bool setup_in_progress_; | 838 bool setup_in_progress_; |
| 837 | 839 |
| 838 // The set of currently enabled sync experiments. | 840 // The set of currently enabled sync experiments. |
| 839 syncer::Experiments current_experiments; | 841 syncer::Experiments current_experiments; |
| 840 | 842 |
| 841 // Factory the backend will use to build the SyncManager. | 843 // Factory the backend will use to build the SyncManager. |
| 842 syncer::SyncManagerFactory sync_manager_factory_; | 844 syncer::SyncManagerFactory sync_manager_factory_; |
| 843 | 845 |
| 844 // Dispatches invalidations to handlers. | 846 // Dispatches invalidations to handlers. Set in Initialize() and |
| 845 syncer::InvalidatorRegistrar invalidator_registrar_; | 847 // unset in Shutdown(). |
| 848 scoped_ptr<syncer::InvalidatorRegistrar> invalidator_registrar_; |
| 846 | 849 |
| 847 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 850 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 848 }; | 851 }; |
| 849 | 852 |
| 850 bool ShouldShowActionOnUI( | 853 bool ShouldShowActionOnUI( |
| 851 const syncer::SyncProtocolError& error); | 854 const syncer::SyncProtocolError& error); |
| 852 | 855 |
| 853 | 856 |
| 854 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 857 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |