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

Side by Side Diff: components/autofill/core/browser/webdata/autocomplete_sync_bridge.h

Issue 2508263003: [sync] skeleton implementation of AutocompleteSyncBridge (Closed)
Patch Set: Max's comments; merged chrome_sync_client Created 4 years 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
OLDNEW
(Empty)
1 // Copyright 2016 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_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
7
8 #include "base/scoped_observer.h"
9 #include "base/supports_user_data.h"
10 #include "base/threading/non_thread_safe.h"
11 #include "components/autofill/core/browser/webdata/autofill_change.h"
12 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse rver.h"
13 #include "components/sync/model/metadata_change_list.h"
14 #include "components/sync/model/model_type_sync_bridge.h"
15
16 namespace syncer {
17 class SyncError;
18 }
19
20 namespace autofill {
21
22 class AutofillWebDataBackend;
23 class AutofillWebDataService;
24
25 class AutocompleteSyncBridge : public base::SupportsUserData::Data,
26 public syncer::ModelTypeSyncBridge,
27 public AutofillWebDataServiceObserverOnDBThread {
28 public:
29 AutocompleteSyncBridge();
30 AutocompleteSyncBridge(
31 AutofillWebDataBackend* backend,
32 const ChangeProcessorFactory& change_processor_factory);
33 ~AutocompleteSyncBridge() override;
34
35 static void CreateForWebDataServiceAndBackend(
36 AutofillWebDataService* web_data_service,
37 AutofillWebDataBackend* web_data_backend);
38
39 static AutocompleteSyncBridge* FromWebDataService(
40 AutofillWebDataService* web_data_service);
41
42 // syncer::ModelTypeService implementation.
43 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
44 override;
45 syncer::SyncError MergeSyncData(
46 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
47 syncer::EntityDataMap entity_data_map) override;
48 syncer::SyncError ApplySyncChanges(
49 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
50 syncer::EntityChangeList entity_changes) override;
51 void GetData(StorageKeyList storage_keys, DataCallback callback) override;
52 void GetAllData(DataCallback callback) override;
53 // Generate a tag that uniquely identifies |entity_data| across all data
54 // types. This is used to identify the entity on the server. The format, which
55 // must remain the same for server compatibility, is:
56 // "autofill_entry|$name|$value" where $name and $value are escaped.
57 std::string GetClientTag(const syncer::EntityData& entity_data) override;
58 // Generate a string key uniquely identifying |entity_data| in the context of
59 // local storage. The format, which should stay the same, is $name|$value"
60 // where $name and $value are escaped.
61 std::string GetStorageKey(const syncer::EntityData& entity_data) override;
62
63 // AutofillWebDataServiceObserverOnDBThread implementation.
64 void AutofillEntriesChanged(const AutofillChangeList& changes) override;
65
66 private:
67 base::ThreadChecker thread_checker_;
68
69 // AutocompleteSyncBridge is owned by |web_data_backend_| through
70 // SupportsUserData, so it's guaranteed to outlive |this|.
71 AutofillWebDataBackend* const web_data_backend_;
72
73 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge>
74 scoped_observer_;
75 };
76
77 } // namespace autofill
78
79 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/BUILD.gn ('k') | components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698