Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1275)

Unified Diff: chrome/browser/extensions/api/storage/syncable_settings_storage.cc

Issue 165223003: Add a Restore() method to ValueStore and make StorageAPI use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/storage/syncable_settings_storage.cc
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
index db877c6882bad8e34362faf01c7b9974e48fd2cc..a9df5945e50cd33d115fa77aff1bb31b6db96b69 100644
--- a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
+++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
@@ -122,6 +122,28 @@ ValueStore::WriteResult SyncableSettingsStorage::Clear() {
return result.Pass();
}
+bool SyncableSettingsStorage::Restore() {
+ // If we're syncing, stop - we don't want to push the deletion of any data.
+ // At next startup, when we start up the sync service, we'll get back any
+ // data which was stored intact on Sync.
+ // TODO (rdevlin.cronin): Investigate if there's a way we can trigger
+ // MergeDataAndStartSyncing() to immediately get back any data we can,
+ // and continue syncing.
+ StopSyncing();
+ return delegate_->Restore();
+}
+
+bool SyncableSettingsStorage::RestoreKey(const std::string& key) {
+ // If we're syncing, stop - we don't want to push the deletion of any data.
+ // At next startup, when we start up the sync service, we'll get back any
+ // data which was stored intact on Sync.
+ // TODO (rdevlin.cronin): Investigate if there's a way we can trigger
+ // MergeDataAndStartSyncing() to immediately get back any data we can,
+ // and continue syncing.
+ StopSyncing();
+ return delegate_->RestoreKey(key);
+}
+
void SyncableSettingsStorage::SyncResultIfEnabled(
const ValueStore::WriteResult& result) {
if (result->changes().empty())

Powered by Google App Engine
This is Rietveld 408576698