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

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

Issue 2508263003: [sync] skeleton implementation of AutocompleteSyncBridge (Closed)
Patch Set: [sync] skeleton implementation of autocomplete_sync_bridge 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.
maxbogue 2016/11/18 22:22:36 line below
Patrick Noland 2016/11/22 18:51:04 Done.
4 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
5 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
6
7 #include "base/scoped_observer.h"
8 #include "base/supports_user_data.h"
9 #include "base/threading/non_thread_safe.h"
10 #include "components/autofill/core/browser/webdata/autofill_change.h"
11 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse rver.h"
12 #include "components/sync/model/model_type_sync_bridge.h"
13
14 namespace syncer {
15 class SyncError;
16 }
17
18 namespace autofill {
maxbogue 2016/11/18 22:22:36 line below
Patrick Noland 2016/11/22 18:51:04 Done.
19 class AutofillTable;
20 class AutofillWebDataBackend;
21 class AutofillWebDataService;
22
23 class AutocompleteSyncBridge : public base::SupportsUserData::Data,
24 public syncer::ModelTypeSyncBridge,
25 public AutofillWebDataServiceObserverOnDBThread,
26 public base::NonThreadSafe {
maxbogue 2016/11/18 22:22:36 It's discouraged to use this class and encouraged
Patrick Noland 2016/11/22 18:51:04 Done.
27 public:
28 ~AutocompleteSyncBridge() override;
maxbogue 2016/11/18 22:22:36 destructor generally goes below constructors
Patrick Noland 2016/11/22 18:51:04 Done.
29 AutocompleteSyncBridge();
30 AutocompleteSyncBridge(
31 AutofillWebDataBackend* backend,
32 const ChangeProcessorFactory& change_processor_factory);
33
34 static void CreateForWebDataServiceAndBackend(
35 AutofillWebDataService* web_data_service,
36 AutofillWebDataBackend* web_data_backend);
37
38 static AutocompleteSyncBridge* FromWebDataService(
39 AutofillWebDataService* web_data_service);
40
41 static syncer::ModelType model_type() { return syncer::AUTOFILL; }
maxbogue 2016/11/18 22:22:36 I don't think you need this.
Patrick Noland 2016/11/22 18:51:04 Done.
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 std::string GetClientTag(const syncer::EntityData& entity_data) override;
pavely 2016/11/21 22:54:19 GetClientTag and GetStorageKey affect how entries
Patrick Noland 2016/11/22 18:51:04 Done.
55 std::string GetStorageKey(const syncer::EntityData& entity_data) override;
56 syncer::ConflictResolution ResolveConflict(
57 const syncer::EntityData& local_data,
58 const syncer::EntityData& remote_data) const override;
59
60 // AutofillWebDataServiceObserverOnDBThread implementation.
61 void AutofillEntriesChanged(const AutofillChangeList& changes) override;
62
63 private:
64 // The |web_data_backend_| is expected to outlive |this|.
maxbogue 2016/11/18 22:22:36 Generally you want to use stronger language ("is g
pavely 2016/11/21 22:54:19 You can mention that AutocompleteSyncBridge is own
Patrick Noland 2016/11/22 18:51:04 Done.
Patrick Noland 2016/11/22 18:51:04 Done.
65 AutofillWebDataBackend* const web_data_backend_;
66
67 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge>
68 scoped_observer_;
69
70 static std::string KeyToTag(std::string storage_key);
maxbogue 2016/11/18 22:22:36 There isn't really a reason to have a private stat
Patrick Noland 2016/11/22 18:51:04 It's possible that unit tests will need it(that's
71 };
72 } // namespace autofill
maxbogue 2016/11/18 22:22:36 Add blank line above this.
Patrick Noland 2016/11/22 18:51:04 Done.
73
74 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698