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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SYNC_BRIDGE_H_
6 #define COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SYNC_BRIDGE_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "components/sync/model/model_type_store.h"
13 #include "components/sync/model/model_type_sync_bridge.h"
14
15 namespace syncer {
16
17 class UserEventSyncBridge : public ModelTypeSyncBridge {
18 public:
19 UserEventSyncBridge(const ModelTypeStoreFactory& store_factory,
20 const ChangeProcessorFactory& change_processor_factory);
21 ~UserEventSyncBridge() override;
22
23 // ModelTypeSyncBridge implementation.
24 std::unique_ptr<MetadataChangeList> CreateMetadataChangeList() override;
25 base::Optional<ModelError> MergeSyncData(
26 std::unique_ptr<MetadataChangeList> metadata_change_list,
27 EntityDataMap entity_data_map) override;
28 base::Optional<ModelError> ApplySyncChanges(
29 std::unique_ptr<MetadataChangeList> metadata_change_list,
30 EntityChangeList entity_changes) override;
31 void GetData(StorageKeyList storage_keys, DataCallback callback) override;
32 void GetAllData(DataCallback callback) override;
33 std::string GetClientTag(const EntityData& entity_data) override;
34 std::string GetStorageKey(const EntityData& entity_data) override;
35 void DisableSync() override;
36
37 void RecordUserEvent(std::unique_ptr<sync_pb::UserEventSpecifics> specifics);
38
39 private:
40 void OnStoreCreated(ModelTypeStore::Result result,
41 std::unique_ptr<ModelTypeStore> store);
42 void OnReadAllMetadata(base::Optional<ModelError> error,
43 std::unique_ptr<MetadataBatch> metadata_batch);
44 void OnCommit(ModelTypeStore::Result result);
45 void OnReadData(DataCallback callback,
46 ModelTypeStore::Result result,
47 std::unique_ptr<ModelTypeStore::RecordList> data_records,
48 std::unique_ptr<ModelTypeStore::IdList> missing_id_list);
49 void OnReadAllData(DataCallback callback,
50 ModelTypeStore::Result result,
51 std::unique_ptr<ModelTypeStore::RecordList> data_records);
52 void OnReadAllDataToDelete(
53 ModelTypeStore::Result result,
54 std::unique_ptr<ModelTypeStore::RecordList> data_records);
55
56 // Persistent storage for in flight events. Should remain quite small, as we
57 // delete upon commit confirmation.
58 std::unique_ptr<ModelTypeStore> store_;
59
60 DISALLOW_COPY_AND_ASSIGN(UserEventSyncBridge);
61 };
62
63 } // namespace syncer
64
65 #endif // COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SYNC_BRIDGE_H_
OLDNEW
« 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