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