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

Unified Diff: components/sync/user_events/user_event_sync_bridge.h

Issue 2856933005: [Sync] Create UserEventSyncBridge. (Closed)
Patch Set: Removing autocomplete_sync_bridge_unittest.cc from cl. Created 3 years, 7 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
« no previous file with comments | « components/sync/user_events/DEPS ('k') | components/sync/user_events/user_event_sync_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/user_events/user_event_sync_bridge.h
diff --git a/components/sync/user_events/user_event_sync_bridge.h b/components/sync/user_events/user_event_sync_bridge.h
new file mode 100644
index 0000000000000000000000000000000000000000..9af5a9d5a7566ec19282a04215db8f95e0a8ae2d
--- /dev/null
+++ b/components/sync/user_events/user_event_sync_bridge.h
@@ -0,0 +1,65 @@
+// 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_USER_EVENTS_USER_EVENT_SYNC_BRIDGE_H_
+#define COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SYNC_BRIDGE_H_
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "components/sync/model/model_type_store.h"
+#include "components/sync/model/model_type_sync_bridge.h"
+
+namespace syncer {
+
+class UserEventSyncBridge : public ModelTypeSyncBridge {
+ public:
+ UserEventSyncBridge(const ModelTypeStoreFactory& store_factory,
+ const ChangeProcessorFactory& change_processor_factory);
+ ~UserEventSyncBridge() override;
+
+ // ModelTypeSyncBridge implementation.
+ std::unique_ptr<MetadataChangeList> CreateMetadataChangeList() override;
+ base::Optional<ModelError> MergeSyncData(
+ std::unique_ptr<MetadataChangeList> metadata_change_list,
+ EntityDataMap entity_data_map) override;
+ base::Optional<ModelError> ApplySyncChanges(
+ std::unique_ptr<MetadataChangeList> metadata_change_list,
+ EntityChangeList entity_changes) override;
+ void GetData(StorageKeyList storage_keys, DataCallback callback) override;
+ void GetAllData(DataCallback callback) override;
+ std::string GetClientTag(const EntityData& entity_data) override;
+ std::string GetStorageKey(const EntityData& entity_data) override;
+ void DisableSync() override;
+
+ void RecordUserEvent(std::unique_ptr<sync_pb::UserEventSpecifics> specifics);
+
+ private:
+ void OnStoreCreated(ModelTypeStore::Result result,
+ std::unique_ptr<ModelTypeStore> store);
+ void OnReadAllMetadata(base::Optional<ModelError> error,
+ std::unique_ptr<MetadataBatch> metadata_batch);
+ void OnCommit(ModelTypeStore::Result result);
+ void OnReadData(DataCallback callback,
+ ModelTypeStore::Result result,
+ std::unique_ptr<ModelTypeStore::RecordList> data_records,
+ std::unique_ptr<ModelTypeStore::IdList> missing_id_list);
+ void OnReadAllData(DataCallback callback,
+ ModelTypeStore::Result result,
+ std::unique_ptr<ModelTypeStore::RecordList> data_records);
+ void OnReadAllDataToDelete(
+ ModelTypeStore::Result result,
+ std::unique_ptr<ModelTypeStore::RecordList> data_records);
+
+ // Persistent storage for in flight events. Should remain quite small, as we
+ // delete upon commit confirmation.
+ std::unique_ptr<ModelTypeStore> store_;
+
+ DISALLOW_COPY_AND_ASSIGN(UserEventSyncBridge);
+};
+
+} // namespace syncer
+
+#endif // COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SYNC_BRIDGE_H_
« no previous file with comments | « components/sync/user_events/DEPS ('k') | components/sync/user_events/user_event_sync_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698