| 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 |
| 11 #include "sync/base/sync_export.h" | 11 #include "sync/base/sync_export.h" |
| 12 #include "sync/internal_api/public/http_post_provider_factory.h" | 12 #include "sync/internal_api/public/http_post_provider_factory.h" |
| 13 #include "sync/internal_api/public/internal_components_factory.h" | |
| 14 #include "sync/internal_api/public/sync_manager.h" | 13 #include "sync/internal_api/public/sync_manager.h" |
| 15 #include "sync/internal_api/public/user_share.h" | 14 #include "sync/internal_api/public/user_share.h" |
| 16 #include "sync/syncable/directory_change_delegate.h" | 15 #include "sync/syncable/directory_change_delegate.h" |
| 17 #include "sync/syncable/transaction_observer.h" | 16 #include "sync/syncable/transaction_observer.h" |
| 18 | 17 |
| 19 namespace syncer { | 18 namespace syncer { |
| 20 | 19 |
| 21 class WriteTransaction; | 20 class WriteTransaction; |
| 22 | 21 |
| 23 // Base class of sync managers used for backup and rollback. Two major | 22 // Base class of sync managers used for backup and rollback. Two major |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 92 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
| 94 ModelTypeSet models_with_changes) OVERRIDE; | 93 ModelTypeSet models_with_changes) OVERRIDE; |
| 95 | 94 |
| 96 protected: | 95 protected: |
| 97 ObserverList<SyncManager::Observer>* GetObservers(); | 96 ObserverList<SyncManager::Observer>* GetObservers(); |
| 98 | 97 |
| 99 // Initialize sync backup DB. | 98 // Initialize sync backup DB. |
| 100 bool InitInternal( | 99 bool InitInternal( |
| 101 const base::FilePath& database_location, | 100 const base::FilePath& database_location, |
| 102 InternalComponentsFactory* internal_components_factory, | 101 InternalComponentsFactory* internal_components_factory, |
| 103 InternalComponentsFactory::StorageOption storage, | |
| 104 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, | 102 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, |
| 105 ReportUnrecoverableErrorFunction report_unrecoverable_error_function); | 103 ReportUnrecoverableErrorFunction report_unrecoverable_error_function); |
| 106 | 104 |
| 107 virtual void RegisterDirectoryTypeDebugInfoObserver( | 105 virtual void RegisterDirectoryTypeDebugInfoObserver( |
| 108 syncer::TypeDebugInfoObserver* observer) OVERRIDE; | 106 syncer::TypeDebugInfoObserver* observer) OVERRIDE; |
| 109 virtual void UnregisterDirectoryTypeDebugInfoObserver( | 107 virtual void UnregisterDirectoryTypeDebugInfoObserver( |
| 110 syncer::TypeDebugInfoObserver* observer) OVERRIDE; | 108 syncer::TypeDebugInfoObserver* observer) OVERRIDE; |
| 111 virtual bool HasDirectoryTypeDebugInfoObserver( | 109 virtual bool HasDirectoryTypeDebugInfoObserver( |
| 112 syncer::TypeDebugInfoObserver* observer) OVERRIDE; | 110 syncer::TypeDebugInfoObserver* observer) OVERRIDE; |
| 113 virtual void RequestEmitDebugInfo() OVERRIDE; | 111 virtual void RequestEmitDebugInfo() OVERRIDE; |
| 114 | 112 |
| 115 bool initialized() const { | 113 bool initialized() const { |
| 116 return initialized_; | 114 return initialized_; |
| 117 } | 115 } |
| 118 | 116 |
| 119 private: | 117 private: |
| 120 void NotifyInitializationSuccess(); | 118 void NotifyInitializationSuccess(); |
| 121 void NotifyInitializationFailure(); | 119 void NotifyInitializationFailure(); |
| 122 | 120 |
| 123 bool InitBackupDB(const base::FilePath& sync_folder, | 121 bool InitBackupDB( |
| 124 InternalComponentsFactory* internal_components_factory, | 122 const base::FilePath& sync_folder, |
| 125 InternalComponentsFactory::StorageOption storage); | 123 InternalComponentsFactory* internal_components_factory); |
| 126 | 124 |
| 127 bool InitTypeRootNode(ModelType type); | 125 bool InitTypeRootNode(ModelType type); |
| 128 void InitBookmarkFolder(const std::string& folder); | 126 void InitBookmarkFolder(const std::string& folder); |
| 129 | 127 |
| 130 UserShare share_; | 128 UserShare share_; |
| 131 ObserverList<SyncManager::Observer> observers_; | 129 ObserverList<SyncManager::Observer> observers_; |
| 132 | 130 |
| 133 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler_; | 131 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler_; |
| 134 ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; | 132 ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; |
| 135 | 133 |
| 136 base::WeakPtrFactory<SyncRollbackManagerBase> weak_ptr_factory_; | 134 base::WeakPtrFactory<SyncRollbackManagerBase> weak_ptr_factory_; |
| 137 | 135 |
| 138 scoped_ptr<SyncEncryptionHandler> dummy_handler_; | 136 scoped_ptr<SyncEncryptionHandler> dummy_handler_; |
| 139 | 137 |
| 140 bool initialized_; | 138 bool initialized_; |
| 141 | 139 |
| 142 DISALLOW_COPY_AND_ASSIGN(SyncRollbackManagerBase); | 140 DISALLOW_COPY_AND_ASSIGN(SyncRollbackManagerBase); |
| 143 }; | 141 }; |
| 144 | 142 |
| 145 } // namespace syncer | 143 } // namespace syncer |
| 146 | 144 |
| 147 #endif // SYNC_INTERNAL_API_SYNC_ROLLBACK_MANAGER_BASE_H_ | 145 #endif // SYNC_INTERNAL_API_SYNC_ROLLBACK_MANAGER_BASE_H_ |
| OLD | NEW |