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

Unified Diff: components/sync/model/recording_model_type_change_processor.h

Issue 2620783002: [sync] Handle local changes in AutocompleteSyncBridge (Closed)
Patch Set: rebase Created 3 years, 11 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: components/sync/model/recording_model_type_change_processor.h
diff --git a/components/sync/model/recording_model_type_change_processor.h b/components/sync/model/recording_model_type_change_processor.h
new file mode 100644
index 0000000000000000000000000000000000000000..d0789b4e6e5de0d3da03b6d3980e5863e169782e
--- /dev/null
+++ b/components/sync/model/recording_model_type_change_processor.h
@@ -0,0 +1,48 @@
+// Copyright 2017 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 COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_
+#define COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_
+
+#include "components/sync/model/fake_model_type_change_processor.h"
+
+namespace syncer {
+
+// Augmented FakeModelTypeChangeProcessor that accumulates all instructions in
+// members that can then be accessed for verification.
+class RecordingModelTypeChangeProcessor : public FakeModelTypeChangeProcessor {
+ public:
+ RecordingModelTypeChangeProcessor();
+ ~RecordingModelTypeChangeProcessor() override;
+
+ // FakeModelTypeChangeProcessor overrides.
+ void Put(const std::string& storage_key,
+ std::unique_ptr<EntityData> entity_data,
+ MetadataChangeList* metadata_changes) override;
+ void Delete(const std::string& storage_key,
+ MetadataChangeList* metadata_changes) override;
+ void ModelReadyToSync(std::unique_ptr<MetadataBatch> batch) override;
+ bool IsTrackingMetadata() override;
+
+ void SetIsTrackingMetadata(bool is_tracking);
+
+ const std::multimap<std::string, std::unique_ptr<EntityData>>& put_multimap()
+ const {
+ return put_multimap_;
+ }
+
+ const std::set<std::string>& delete_set() const { return delete_set_; }
+
+ const MetadataBatch* metadata() const { return metadata_.get(); }
+
+ private:
+ std::multimap<std::string, std::unique_ptr<EntityData>> put_multimap_;
+ std::set<std::string> delete_set_;
+ std::unique_ptr<MetadataBatch> metadata_;
+ bool is_tracking_metadata_ = true;
+};
+
+} // namespace syncer
+
+#endif // COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_

Powered by Google App Engine
This is Rietveld 408576698