Index: sync/internal_api/sync_backup_manager.h |
diff --git a/sync/internal_api/sync_backup_manager.h b/sync/internal_api/sync_backup_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..842482c4d58e4b874023ae8b7cb91ed0338d31ec |
--- /dev/null |
+++ b/sync/internal_api/sync_backup_manager.h |
@@ -0,0 +1,44 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ |
+#define SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ |
+ |
+#include <set> |
+ |
+#include "sync/internal_api/sync_rollback_manager_base.h" |
+ |
+namespace syncer { |
+ |
+// SyncBackupManager runs before user signs into sync to back up user's data |
Nicolas Zea
2014/04/15 23:05:51
nit: into -> in to
haitaol1
2014/04/16 21:52:36
Done.
|
+// before sync starts. The data that's backed up can be used to restore user's |
+// settings to pre-sync state. |
+class SyncBackupManager : public SyncRollbackManagerBase { |
+ public: |
+ SyncBackupManager(); |
+ virtual ~SyncBackupManager(); |
+ |
+ // SyncManager implementation. |
+ virtual void SaveChanges() OVERRIDE; |
+ |
+ // DirectoryChangeDelegate implementation. |
+ virtual ModelTypeSet HandleTransactionEndingChangeEvent( |
+ const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
+ syncable::BaseTransaction* trans) OVERRIDE; |
+ |
+ private: |
+ // Replaces local IDs with server IDs and clear unsynced bit of modified |
+ // entries. |
+ void NormalizeEntries(); |
+ |
+ // Handles of unsynced entries caused by local model changes. |
+ std::set<int64> unsynced_; |
+ |
+ // True if NormalizeEntries() is being called. |
+ bool in_normalization_; |
+}; |
+ |
+} // namespace syncer |
+ |
+#endif // SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ |