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

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

Issue 2508263003: [sync] skeleton implementation of AutocompleteSyncBridge (Closed)
Patch Set: Address Max and Pavel's comments Created 4 years, 1 month 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 AutofillTable;
23 class AutofillWebDataBackend;
24 class AutofillWebDataService;
25
26 class AutocompleteSyncBridge : public base::SupportsUserData::Data,
27 public syncer::ModelTypeSyncBridge,
28 public AutofillWebDataServiceObserverOnDBThread {
29 public:
30 AutocompleteSyncBridge();
31 ~AutocompleteSyncBridge() override;
maxbogue 2016/11/22 19:07:23 under both constructors plz
Patrick Noland 2016/11/29 00:09:50 Done.
32 AutocompleteSyncBridge(
33 AutofillWebDataBackend* backend,
34 const ChangeProcessorFactory& change_processor_factory);
35
36 static void CreateForWebDataServiceAndBackend(
37 AutofillWebDataService* web_data_service,
38 AutofillWebDataBackend* web_data_backend);
39
40 static AutocompleteSyncBridge* FromWebDataService(
41 AutofillWebDataService* web_data_service);
42
43 // syncer::ModelTypeService implementation.
44 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
45 override;
46 syncer::SyncError MergeSyncData(
47 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
48 syncer::EntityDataMap entity_data_map) override;
49 syncer::SyncError ApplySyncChanges(
50 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
51 syncer::EntityChangeList entity_changes) override;
52 void GetData(StorageKeyList storage_keys, DataCallback callback) override;
53 void GetAllData(DataCallback callback) override;
54 // Generate a tag that uniquely identifies |entity_data| across all data
55 // types. This is used to identify the entity on the server. The format, which
56 // must remain the same for server compatibility, is:
57 // "autofill_entry|$name|$value" where $name and $value are escaped.
58 std::string GetClientTag(const syncer::EntityData& entity_data) override;
59 // Generate a string key uniquely identifying |entity_data| in the context of
60 // local storage. The format, which should stay the same, is $name|$value"
61 // where $name and $value are escaped.
62 std::string GetStorageKey(const syncer::EntityData& entity_data) override;
63
64 // AutofillWebDataServiceObserverOnDBThread implementation.
65 void AutofillEntriesChanged(const AutofillChangeList& changes) override;
66
67 private:
68 base::ThreadChecker thread_checker_;
69
70 // AutocompleteSyncBridge is owned by |web_data_backend_| through
71 // SupportsUserData, so it's guaranteed to outlive |this|.
72 AutofillWebDataBackend* const web_data_backend_;
73
74 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge>
75 scoped_observer_;
76 };
77 } // namespace autofill
maxbogue 2016/11/22 19:07:23 line above this please. sorry to be so picky about
Patrick Noland 2016/11/29 00:09:50 Done.
78
79 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698