diff options
author | haitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-21 18:35:44 +0000 |
---|---|---|
committer | haitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-21 18:35:44 +0000 |
commit | d50311f0a8785d61a806337d842e0a48bb3e75f4 (patch) | |
tree | 2568bafe3ee83322c1e646931516ccd41d8f7e3b /sync/internal_api/sync_rollback_manager.h | |
parent | bcae6b83ce10987bf5bca2fddfc9e2c058a5c4b5 (diff) | |
download | chromium_src-d50311f0a8785d61a806337d842e0a48bb3e75f4.zip chromium_src-d50311f0a8785d61a806337d842e0a48bb3e75f4.tar.gz chromium_src-d50311f0a8785d61a806337d842e0a48bb3e75f4.tar.bz2 |
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
Diffstat (limited to 'sync/internal_api/sync_rollback_manager.h')
-rw-r--r-- | sync/internal_api/sync_rollback_manager.h | 62 |
1 files changed, 62 insertions, 0 deletions
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 <string> +#include <vector> + +#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<JsEventHandler>& event_handler, + const std::string& sync_server_and_path, + int sync_server_port, + bool use_ssl, + scoped_ptr<HttpPostProviderFactory> post_factory, + const std::vector<scoped_refptr<ModelSafeWorker> >& 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<UnrecoverableErrorHandler> 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<int64> handles); + + std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker> > 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_ |