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

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

Issue 2620783002: [sync] Handle local changes in AutocompleteSyncBridge (Closed)
Patch Set: rebase onto sky's changes Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 24 matching lines...) Expand all
35 const ChangeProcessorFactory& change_processor_factory); 35 const ChangeProcessorFactory& change_processor_factory);
36 ~AutocompleteSyncBridge() override; 36 ~AutocompleteSyncBridge() override;
37 37
38 static void CreateForWebDataServiceAndBackend( 38 static void CreateForWebDataServiceAndBackend(
39 AutofillWebDataService* web_data_service, 39 AutofillWebDataService* web_data_service,
40 AutofillWebDataBackend* web_data_backend); 40 AutofillWebDataBackend* web_data_backend);
41 41
42 static AutocompleteSyncBridge* FromWebDataService( 42 static AutocompleteSyncBridge* FromWebDataService(
43 AutofillWebDataService* web_data_service); 43 AutofillWebDataService* web_data_service);
44 44
45 // syncer::ModelTypeService implementation. 45 // syncer::ModelTypeSyncBridge implementation.
46 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList() 46 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
47 override; 47 override;
48 base::Optional<syncer::ModelError> MergeSyncData( 48 base::Optional<syncer::ModelError> MergeSyncData(
49 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, 49 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
50 syncer::EntityDataMap entity_data_map) override; 50 syncer::EntityDataMap entity_data_map) override;
51 base::Optional<syncer::ModelError> ApplySyncChanges( 51 base::Optional<syncer::ModelError> ApplySyncChanges(
52 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, 52 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
53 syncer::EntityChangeList entity_changes) override; 53 syncer::EntityChangeList entity_changes) override;
54 void GetData(StorageKeyList storage_keys, DataCallback callback) override; 54 void GetData(StorageKeyList storage_keys, DataCallback callback) override;
55 void GetAllData(DataCallback callback) override; 55 void GetAllData(DataCallback callback) override;
56 // Generate a tag that uniquely identifies |entity_data| across all data 56 // Generate a tag that uniquely identifies |entity_data| across all data
57 // types. This is used to identify the entity on the server. The format, which 57 // types. This is used to identify the entity on the server. The format, which
58 // must remain the same for server compatibility, is: 58 // must remain the same for server compatibility, is:
59 // "autofill_entry|$name|$value" where $name and $value are escaped. 59 // "autofill_entry|$name|$value" where $name and $value are escaped.
60 std::string GetClientTag(const syncer::EntityData& entity_data) override; 60 std::string GetClientTag(const syncer::EntityData& entity_data) override;
61 // Generate a string key uniquely identifying |entity_data| in the context of 61 // Generate a string key uniquely identifying |entity_data| in the context of
62 // local storage. The format, which should stay the same, is $name|$value" 62 // local storage. The format, which should stay the same, is $name|$value"
63 // where $name and $value are escaped. 63 // where $name and $value are escaped.
64 std::string GetStorageKey(const syncer::EntityData& entity_data) override; 64 std::string GetStorageKey(const syncer::EntityData& entity_data) override;
65 65
66 // AutofillWebDataServiceObserverOnDBThread implementation. 66 // AutofillWebDataServiceObserverOnDBThread implementation.
67 void AutofillEntriesChanged(const AutofillChangeList& changes) override; 67 void AutofillEntriesChanged(const AutofillChangeList& changes) override;
68 68
69 private: 69 private:
70 // Returns the table associated with the |web_data_backend_|. 70 // Returns the table associated with the |web_data_backend_|.
71 AutofillTable* GetAutofillTable() const; 71 AutofillTable* GetAutofillTable() const;
72 72
73 std::string GetStorageKeyFromAutofillEntry( 73 // Respond to local autofill entries changing by notifying sync of the
74 const autofill::AutofillEntry& entry); 74 // changes.
75 void ActOnLocalChanges(const AutofillChangeList& changes);
75 76
76 static std::string FormatStorageKey(const std::string& name, 77 void LoadMetadata();
Patrick Noland 2017/01/13 23:31:53 I'll add a comment for this function.
Patrick Noland 2017/01/17 22:59:55 Done.
77 const std::string& value);
78 78
79 base::ThreadChecker thread_checker_; 79 base::ThreadChecker thread_checker_;
80 80
81 // AutocompleteSyncBridge is owned by |web_data_backend_| through 81 // AutocompleteSyncBridge is owned by |web_data_backend_| through
82 // SupportsUserData, so it's guaranteed to outlive |this|. 82 // SupportsUserData, so it's guaranteed to outlive |this|.
83 AutofillWebDataBackend* const web_data_backend_; 83 AutofillWebDataBackend* const web_data_backend_;
84 84
85 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> 85 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge>
86 scoped_observer_; 86 scoped_observer_;
87 87
88 DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncBridge); 88 DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncBridge);
89 }; 89 };
90 90
91 } // namespace autofill 91 } // namespace autofill
92 92
93 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ 93 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698