| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SYNC_INTERNAL_API_SYNC_ROLLBACK_MANAGER_BASE_H_ | 5 #ifndef SYNC_INTERNAL_API_SYNC_ROLLBACK_MANAGER_BASE_H_ |
| 6 #define SYNC_INTERNAL_API_SYNC_ROLLBACK_MANAGER_BASE_H_ | 6 #define SYNC_INTERNAL_API_SYNC_ROLLBACK_MANAGER_BASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // * ConfigureSyncer(): initialize permanent sync nodes (root, bookmark | 26 // * ConfigureSyncer(): initialize permanent sync nodes (root, bookmark |
| 27 // permanent folders) for configured type as needed. | 27 // permanent folders) for configured type as needed. |
| 28 // | 28 // |
| 29 // Most of other functions are no ops. | 29 // Most of other functions are no ops. |
| 30 class SYNC_EXPORT_PRIVATE SyncRollbackManagerBase : | 30 class SYNC_EXPORT_PRIVATE SyncRollbackManagerBase : |
| 31 public SyncManager, | 31 public SyncManager, |
| 32 public syncable::DirectoryChangeDelegate, | 32 public syncable::DirectoryChangeDelegate, |
| 33 public syncable::TransactionObserver { | 33 public syncable::TransactionObserver { |
| 34 public: | 34 public: |
| 35 SyncRollbackManagerBase(); | 35 SyncRollbackManagerBase(); |
| 36 virtual ~SyncRollbackManagerBase(); | 36 ~SyncRollbackManagerBase() override; |
| 37 | 37 |
| 38 // SyncManager implementation. | 38 // SyncManager implementation. |
| 39 virtual ModelTypeSet InitialSyncEndedTypes() override; | 39 ModelTypeSet InitialSyncEndedTypes() override; |
| 40 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 40 ModelTypeSet GetTypesWithEmptyProgressMarkerToken( |
| 41 ModelTypeSet types) override; | 41 ModelTypeSet types) override; |
| 42 virtual bool PurgePartiallySyncedTypes() override; | 42 bool PurgePartiallySyncedTypes() override; |
| 43 virtual void UpdateCredentials(const SyncCredentials& credentials) override; | 43 void UpdateCredentials(const SyncCredentials& credentials) override; |
| 44 virtual void StartSyncingNormally(const ModelSafeRoutingInfo& routing_info) | 44 void StartSyncingNormally(const ModelSafeRoutingInfo& routing_info) override; |
| 45 override; | 45 void ConfigureSyncer(ConfigureReason reason, |
| 46 virtual void ConfigureSyncer( | 46 ModelTypeSet to_download, |
| 47 ConfigureReason reason, | 47 ModelTypeSet to_purge, |
| 48 ModelTypeSet to_download, | 48 ModelTypeSet to_journal, |
| 49 ModelTypeSet to_purge, | 49 ModelTypeSet to_unapply, |
| 50 ModelTypeSet to_journal, | 50 const ModelSafeRoutingInfo& new_routing_info, |
| 51 ModelTypeSet to_unapply, | 51 const base::Closure& ready_task, |
| 52 const ModelSafeRoutingInfo& new_routing_info, | 52 const base::Closure& retry_task) override; |
| 53 const base::Closure& ready_task, | 53 void SetInvalidatorEnabled(bool invalidator_enabled) override; |
| 54 const base::Closure& retry_task) override; | 54 void OnIncomingInvalidation( |
| 55 virtual void SetInvalidatorEnabled(bool invalidator_enabled) override; | |
| 56 virtual void OnIncomingInvalidation( | |
| 57 syncer::ModelType type, | 55 syncer::ModelType type, |
| 58 scoped_ptr<InvalidationInterface> invalidation) override; | 56 scoped_ptr<InvalidationInterface> invalidation) override; |
| 59 virtual void AddObserver(SyncManager::Observer* observer) override; | 57 void AddObserver(SyncManager::Observer* observer) override; |
| 60 virtual void RemoveObserver(SyncManager::Observer* observer) override; | 58 void RemoveObserver(SyncManager::Observer* observer) override; |
| 61 virtual SyncStatus GetDetailedStatus() const override; | 59 SyncStatus GetDetailedStatus() const override; |
| 62 virtual void SaveChanges() override; | 60 void SaveChanges() override; |
| 63 virtual void ShutdownOnSyncThread(ShutdownReason reason) override; | 61 void ShutdownOnSyncThread(ShutdownReason reason) override; |
| 64 virtual UserShare* GetUserShare() override; | 62 UserShare* GetUserShare() override; |
| 65 virtual const std::string cache_guid() override; | 63 const std::string cache_guid() override; |
| 66 virtual bool ReceivedExperiment(Experiments* experiments) override; | 64 bool ReceivedExperiment(Experiments* experiments) override; |
| 67 virtual bool HasUnsyncedItems() override; | 65 bool HasUnsyncedItems() override; |
| 68 virtual SyncEncryptionHandler* GetEncryptionHandler() override; | 66 SyncEncryptionHandler* GetEncryptionHandler() override; |
| 69 virtual void RefreshTypes(ModelTypeSet types) override; | 67 void RefreshTypes(ModelTypeSet types) override; |
| 70 virtual SyncContextProxy* GetSyncContextProxy() override; | 68 SyncContextProxy* GetSyncContextProxy() override; |
| 71 virtual ScopedVector<ProtocolEvent> GetBufferedProtocolEvents() | 69 ScopedVector<ProtocolEvent> GetBufferedProtocolEvents() override; |
| 72 override; | 70 scoped_ptr<base::ListValue> GetAllNodesForType( |
| 73 virtual scoped_ptr<base::ListValue> GetAllNodesForType( | |
| 74 syncer::ModelType type) override; | 71 syncer::ModelType type) override; |
| 75 | 72 |
| 76 // DirectoryChangeDelegate implementation. | 73 // DirectoryChangeDelegate implementation. |
| 77 virtual void HandleTransactionCompleteChangeEvent( | 74 void HandleTransactionCompleteChangeEvent( |
| 78 ModelTypeSet models_with_changes) override; | 75 ModelTypeSet models_with_changes) override; |
| 79 virtual ModelTypeSet HandleTransactionEndingChangeEvent( | 76 ModelTypeSet HandleTransactionEndingChangeEvent( |
| 80 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 77 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
| 81 syncable::BaseTransaction* trans) override; | 78 syncable::BaseTransaction* trans) override; |
| 82 virtual void HandleCalculateChangesChangeEventFromSyncApi( | 79 void HandleCalculateChangesChangeEventFromSyncApi( |
| 83 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 80 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
| 84 syncable::BaseTransaction* trans, | 81 syncable::BaseTransaction* trans, |
| 85 std::vector<int64>* entries_changed) override; | 82 std::vector<int64>* entries_changed) override; |
| 86 virtual void HandleCalculateChangesChangeEventFromSyncer( | 83 void HandleCalculateChangesChangeEventFromSyncer( |
| 87 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 84 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
| 88 syncable::BaseTransaction* trans, | 85 syncable::BaseTransaction* trans, |
| 89 std::vector<int64>* entries_changed) override; | 86 std::vector<int64>* entries_changed) override; |
| 90 | 87 |
| 91 // syncable::TransactionObserver implementation. | 88 // syncable::TransactionObserver implementation. |
| 92 virtual void OnTransactionWrite( | 89 void OnTransactionWrite( |
| 93 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 90 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
| 94 ModelTypeSet models_with_changes) override; | 91 ModelTypeSet models_with_changes) override; |
| 95 | 92 |
| 96 protected: | 93 protected: |
| 97 ObserverList<SyncManager::Observer>* GetObservers(); | 94 ObserverList<SyncManager::Observer>* GetObservers(); |
| 98 | 95 |
| 99 // Initialize sync backup DB. | 96 // Initialize sync backup DB. |
| 100 bool InitInternal( | 97 bool InitInternal( |
| 101 const base::FilePath& database_location, | 98 const base::FilePath& database_location, |
| 102 InternalComponentsFactory* internal_components_factory, | 99 InternalComponentsFactory* internal_components_factory, |
| 103 InternalComponentsFactory::StorageOption storage, | 100 InternalComponentsFactory::StorageOption storage, |
| 104 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, | 101 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, |
| 105 ReportUnrecoverableErrorFunction report_unrecoverable_error_function); | 102 ReportUnrecoverableErrorFunction report_unrecoverable_error_function); |
| 106 | 103 |
| 107 virtual void RegisterDirectoryTypeDebugInfoObserver( | 104 void RegisterDirectoryTypeDebugInfoObserver( |
| 108 syncer::TypeDebugInfoObserver* observer) override; | 105 syncer::TypeDebugInfoObserver* observer) override; |
| 109 virtual void UnregisterDirectoryTypeDebugInfoObserver( | 106 void UnregisterDirectoryTypeDebugInfoObserver( |
| 110 syncer::TypeDebugInfoObserver* observer) override; | 107 syncer::TypeDebugInfoObserver* observer) override; |
| 111 virtual bool HasDirectoryTypeDebugInfoObserver( | 108 bool HasDirectoryTypeDebugInfoObserver( |
| 112 syncer::TypeDebugInfoObserver* observer) override; | 109 syncer::TypeDebugInfoObserver* observer) override; |
| 113 virtual void RequestEmitDebugInfo() override; | 110 void RequestEmitDebugInfo() override; |
| 114 | 111 |
| 115 bool initialized() const { | 112 bool initialized() const { |
| 116 return initialized_; | 113 return initialized_; |
| 117 } | 114 } |
| 118 | 115 |
| 119 private: | 116 private: |
| 120 void NotifyInitializationSuccess(); | 117 void NotifyInitializationSuccess(); |
| 121 void NotifyInitializationFailure(); | 118 void NotifyInitializationFailure(); |
| 122 | 119 |
| 123 bool InitBackupDB(const base::FilePath& sync_folder, | 120 bool InitBackupDB(const base::FilePath& sync_folder, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 138 bool initialized_; | 135 bool initialized_; |
| 139 | 136 |
| 140 base::WeakPtrFactory<SyncRollbackManagerBase> weak_ptr_factory_; | 137 base::WeakPtrFactory<SyncRollbackManagerBase> weak_ptr_factory_; |
| 141 | 138 |
| 142 DISALLOW_COPY_AND_ASSIGN(SyncRollbackManagerBase); | 139 DISALLOW_COPY_AND_ASSIGN(SyncRollbackManagerBase); |
| 143 }; | 140 }; |
| 144 | 141 |
| 145 } // namespace syncer | 142 } // namespace syncer |
| 146 | 143 |
| 147 #endif // SYNC_INTERNAL_API_SYNC_ROLLBACK_MANAGER_BASE_H_ | 144 #endif // SYNC_INTERNAL_API_SYNC_ROLLBACK_MANAGER_BASE_H_ |
| OLD | NEW |