| 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_BACKUP_MANAGER_H_ | 5 #ifndef SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ |
| 6 #define SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ | 6 #define SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "sync/internal_api/sync_rollback_manager_base.h" | 10 #include "sync/internal_api/sync_rollback_manager_base.h" |
| 11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 namespace syncer { | 13 namespace syncer { |
| 14 | 14 |
| 15 // SyncBackupManager runs before user signs in to sync to back up user's data | 15 // SyncBackupManager runs before user signs in to sync to back up user's data |
| 16 // before sync starts. The data that's backed up can be used to restore user's | 16 // before sync starts. The data that's backed up can be used to restore user's |
| 17 // settings to pre-sync state. | 17 // settings to pre-sync state. |
| 18 class SYNC_EXPORT_PRIVATE SyncBackupManager : public SyncRollbackManagerBase { | 18 class SYNC_EXPORT_PRIVATE SyncBackupManager : public SyncRollbackManagerBase { |
| 19 public: | 19 public: |
| 20 SyncBackupManager(); | 20 SyncBackupManager(); |
| 21 virtual ~SyncBackupManager(); | 21 virtual ~SyncBackupManager(); |
| 22 | 22 |
| 23 // SyncManager implementation. | 23 // SyncManager implementation. |
| 24 virtual void Init(InitArgs* args) OVERRIDE; | 24 virtual void Init(InitArgs* args) override; |
| 25 virtual void SaveChanges() OVERRIDE; | 25 virtual void SaveChanges() override; |
| 26 virtual SyncStatus GetDetailedStatus() const OVERRIDE; | 26 virtual SyncStatus GetDetailedStatus() const override; |
| 27 virtual void ShutdownOnSyncThread(ShutdownReason reason) OVERRIDE; | 27 virtual void ShutdownOnSyncThread(ShutdownReason reason) override; |
| 28 | 28 |
| 29 // DirectoryChangeDelegate implementation. | 29 // DirectoryChangeDelegate implementation. |
| 30 virtual ModelTypeSet HandleTransactionEndingChangeEvent( | 30 virtual ModelTypeSet HandleTransactionEndingChangeEvent( |
| 31 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 31 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
| 32 syncable::BaseTransaction* trans) OVERRIDE; | 32 syncable::BaseTransaction* trans) override; |
| 33 | 33 |
| 34 virtual void RegisterDirectoryTypeDebugInfoObserver( | 34 virtual void RegisterDirectoryTypeDebugInfoObserver( |
| 35 syncer::TypeDebugInfoObserver* observer) OVERRIDE; | 35 syncer::TypeDebugInfoObserver* observer) override; |
| 36 virtual void UnregisterDirectoryTypeDebugInfoObserver( | 36 virtual void UnregisterDirectoryTypeDebugInfoObserver( |
| 37 syncer::TypeDebugInfoObserver* observer) OVERRIDE; | 37 syncer::TypeDebugInfoObserver* observer) override; |
| 38 virtual bool HasDirectoryTypeDebugInfoObserver( | 38 virtual bool HasDirectoryTypeDebugInfoObserver( |
| 39 syncer::TypeDebugInfoObserver* observer) OVERRIDE; | 39 syncer::TypeDebugInfoObserver* observer) override; |
| 40 virtual void RequestEmitDebugInfo() OVERRIDE; | 40 virtual void RequestEmitDebugInfo() override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 // Replaces local IDs with server IDs and clear unsynced bit of modified | 43 // Replaces local IDs with server IDs and clear unsynced bit of modified |
| 44 // entries. | 44 // entries. |
| 45 void NormalizeEntries(); | 45 void NormalizeEntries(); |
| 46 | 46 |
| 47 // Manipulate preference nodes so that they'll be overwritten by local | 47 // Manipulate preference nodes so that they'll be overwritten by local |
| 48 // preference values during model association, i.e. local wins instead of | 48 // preference values during model association, i.e. local wins instead of |
| 49 // server wins. This is for preventing backup from changing preferences in | 49 // server wins. This is for preventing backup from changing preferences in |
| 50 // case backup DB has hijacked preferences. | 50 // case backup DB has hijacked preferences. |
| 51 void HideSyncPreference(ModelType pref_type); | 51 void HideSyncPreference(ModelType pref_type); |
| 52 | 52 |
| 53 // Handles of unsynced entries caused by local model changes. | 53 // Handles of unsynced entries caused by local model changes. |
| 54 std::set<int64> unsynced_; | 54 std::set<int64> unsynced_; |
| 55 | 55 |
| 56 // True if NormalizeEntries() is being called. | 56 // True if NormalizeEntries() is being called. |
| 57 bool in_normalization_; | 57 bool in_normalization_; |
| 58 | 58 |
| 59 SyncStatus status_; | 59 SyncStatus status_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(SyncBackupManager); | 61 DISALLOW_COPY_AND_ASSIGN(SyncBackupManager); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace syncer | 64 } // namespace syncer |
| 65 | 65 |
| 66 #endif // SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ | 66 #endif // SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_ |
| OLD | NEW |