OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ |
| 6 #define SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "sync/internal_api/sync_rollback_manager_base.h" |
| 11 |
| 12 namespace syncer { |
| 13 |
| 14 // SyncBackupManager runs before user signs in to sync to back up user's data |
| 15 // before sync starts. The data that's backed up can be used to restore user's |
| 16 // settings to pre-sync state. |
| 17 class SYNC_EXPORT_PRIVATE SyncBackupManager : public SyncRollbackManagerBase { |
| 18 public: |
| 19 SyncBackupManager(); |
| 20 virtual ~SyncBackupManager(); |
| 21 |
| 22 // SyncManager implementation. |
| 23 virtual void Init( |
| 24 const base::FilePath& database_location, |
| 25 const WeakHandle<JsEventHandler>& event_handler, |
| 26 const std::string& sync_server_and_path, |
| 27 int sync_server_port, |
| 28 bool use_ssl, |
| 29 scoped_ptr<HttpPostProviderFactory> post_factory, |
| 30 const std::vector<scoped_refptr<ModelSafeWorker> >& workers, |
| 31 ExtensionsActivity* extensions_activity, |
| 32 SyncManager::ChangeDelegate* change_delegate, |
| 33 const SyncCredentials& credentials, |
| 34 const std::string& invalidator_client_id, |
| 35 const std::string& restored_key_for_bootstrapping, |
| 36 const std::string& restored_keystore_key_for_bootstrapping, |
| 37 InternalComponentsFactory* internal_components_factory, |
| 38 Encryptor* encryptor, |
| 39 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, |
| 40 ReportUnrecoverableErrorFunction |
| 41 report_unrecoverable_error_function, |
| 42 CancelationSignal* cancelation_signal) OVERRIDE; |
| 43 virtual void SaveChanges() OVERRIDE; |
| 44 virtual SyncStatus GetDetailedStatus() const OVERRIDE; |
| 45 |
| 46 // DirectoryChangeDelegate implementation. |
| 47 virtual ModelTypeSet HandleTransactionEndingChangeEvent( |
| 48 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
| 49 syncable::BaseTransaction* trans) OVERRIDE; |
| 50 |
| 51 private: |
| 52 // Replaces local IDs with server IDs and clear unsynced bit of modified |
| 53 // entries. |
| 54 void NormalizeEntries(); |
| 55 |
| 56 // Handles of unsynced entries caused by local model changes. |
| 57 std::set<int64> unsynced_; |
| 58 |
| 59 // True if NormalizeEntries() is being called. |
| 60 bool in_normalization_; |
| 61 |
| 62 SyncStatus status_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(SyncBackupManager); |
| 65 }; |
| 66 |
| 67 } // namespace syncer |
| 68 |
| 69 #endif // SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ |
OLD | NEW |