From d50311f0a8785d61a806337d842e0a48bb3e75f4 Mon Sep 17 00:00:00 2001 From: "haitaol@chromium.org" Date: Mon, 21 Apr 2014 18:35:44 +0000 Subject: Add sync manager classes for backup/rollback: * SyncBackupManager runs before first-sync to save local data in backup DB. * SyncRollbackManager deletes local data that's not found in backup DB. BUG=362679 Review URL: https://codereview.chromium.org/235053006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265027 0039d316-1c4b-4281-b951-d872f2087c98 --- sync/internal_api/sync_rollback_manager.h | 62 +++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sync/internal_api/sync_rollback_manager.h (limited to 'sync/internal_api/sync_rollback_manager.h') diff --git a/sync/internal_api/sync_rollback_manager.h b/sync/internal_api/sync_rollback_manager.h new file mode 100644 index 0000000..c8b8719 --- /dev/null +++ b/sync/internal_api/sync_rollback_manager.h @@ -0,0 +1,62 @@ +// 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_ROLLBACK_MANAGER_H_ +#define SYNC_INTERNAL_API_SYNC_ROLLBACK_MANAGER_H_ + +#include +#include + +#include "sync/internal_api/sync_rollback_manager_base.h" + +namespace syncer { + +// SyncRollbackManager restores user's data to pre-sync state using backup +// DB created by SyncBackupManager. +class SYNC_EXPORT_PRIVATE SyncRollbackManager : public SyncRollbackManagerBase { + public: + SyncRollbackManager(); + virtual ~SyncRollbackManager(); + + // SyncManager implementation. + virtual void Init( + const base::FilePath& database_location, + const WeakHandle& event_handler, + const std::string& sync_server_and_path, + int sync_server_port, + bool use_ssl, + scoped_ptr post_factory, + const std::vector >& workers, + ExtensionsActivity* extensions_activity, + SyncManager::ChangeDelegate* change_delegate, + const SyncCredentials& credentials, + const std::string& invalidator_client_id, + const std::string& restored_key_for_bootstrapping, + const std::string& restored_keystore_key_for_bootstrapping, + InternalComponentsFactory* internal_components_factory, + Encryptor* encryptor, + scoped_ptr unrecoverable_error_handler, + ReportUnrecoverableErrorFunction + report_unrecoverable_error_function, + CancelationSignal* cancelation_signal) OVERRIDE; + virtual void StartSyncingNormally( + const ModelSafeRoutingInfo& routing_info) OVERRIDE; + + private: + // Deletes specified entries in local model. + SyncerError DeleteOnWorkerThread(ModelType type, std::vector handles); + + std::map > workers_; + + SyncManager::ChangeDelegate* change_delegate_; + + // Types that can be rolled back. + ModelTypeSet rollback_ready_types_; + + DISALLOW_COPY_AND_ASSIGN(SyncRollbackManager); +}; + +} // namespace syncer + +#endif // SYNC_INTERNAL_API_SYNC_ROLLBACK_MANAGER_H_ -- cgit v1.1