Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / sync / internal_api / sync_backup_manager.h
bloba8f5b8a89fc2a8cc9b720e58f207366d3b304706
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.
5 #ifndef SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_
6 #define SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_
8 #include <set>
10 #include "sync/internal_api/sync_rollback_manager_base.h"
11 #include "url/gurl.h"
13 namespace syncer {
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
17 // settings to pre-sync state.
18 class SYNC_EXPORT_PRIVATE SyncBackupManager : public SyncRollbackManagerBase {
19 public:
20 SyncBackupManager();
21 ~SyncBackupManager() override;
23 // SyncManager implementation.
24 void Init(InitArgs* args) override;
25 void SaveChanges() override;
26 SyncStatus GetDetailedStatus() const override;
27 void ShutdownOnSyncThread(ShutdownReason reason) override;
29 // DirectoryChangeDelegate implementation.
30 ModelTypeSet HandleTransactionEndingChangeEvent(
31 const syncable::ImmutableWriteTransactionInfo& write_transaction_info,
32 syncable::BaseTransaction* trans) override;
34 void RegisterDirectoryTypeDebugInfoObserver(
35 syncer::TypeDebugInfoObserver* observer) override;
36 void UnregisterDirectoryTypeDebugInfoObserver(
37 syncer::TypeDebugInfoObserver* observer) override;
38 bool HasDirectoryTypeDebugInfoObserver(
39 syncer::TypeDebugInfoObserver* observer) override;
40 void RequestEmitDebugInfo() override;
41 void ClearServerData(const ClearServerDataCallback& callback) override;
43 private:
44 // Replaces local IDs with server IDs and clear unsynced bit of modified
45 // entries.
46 void NormalizeEntries();
48 // Manipulate preference nodes so that they'll be overwritten by local
49 // preference values during model association, i.e. local wins instead of
50 // server wins. This is for preventing backup from changing preferences in
51 // case backup DB has hijacked preferences.
52 void HideSyncPreference(ModelType pref_type);
54 // Handles of unsynced entries caused by local model changes.
55 std::set<int64> unsynced_;
57 // True if NormalizeEntries() is being called.
58 bool in_normalization_;
60 SyncStatus status_;
62 DISALLOW_COPY_AND_ASSIGN(SyncBackupManager);
65 } // namespace syncer
67 #endif // SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_