Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 22 matching lines...) Expand all Loading... | |
| 33 const ChangeProcessorFactory& change_processor_factory); | 33 const ChangeProcessorFactory& change_processor_factory); |
| 34 ~AutocompleteSyncBridge() override; | 34 ~AutocompleteSyncBridge() override; |
| 35 | 35 |
| 36 static void CreateForWebDataServiceAndBackend( | 36 static void CreateForWebDataServiceAndBackend( |
| 37 AutofillWebDataService* web_data_service, | 37 AutofillWebDataService* web_data_service, |
| 38 AutofillWebDataBackend* web_data_backend); | 38 AutofillWebDataBackend* web_data_backend); |
| 39 | 39 |
| 40 static AutocompleteSyncBridge* FromWebDataService( | 40 static AutocompleteSyncBridge* FromWebDataService( |
| 41 AutofillWebDataService* web_data_service); | 41 AutofillWebDataService* web_data_service); |
| 42 | 42 |
| 43 // syncer::ModelTypeService implementation. | 43 // syncer::ModelTypeSyncBridge implementation. |
| 44 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList() | 44 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList() |
| 45 override; | 45 override; |
| 46 syncer::ModelError MergeSyncData( | 46 syncer::ModelError MergeSyncData( |
| 47 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, | 47 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, |
| 48 syncer::EntityDataMap entity_data_map) override; | 48 syncer::EntityDataMap entity_data_map) override; |
| 49 syncer::ModelError ApplySyncChanges( | 49 syncer::ModelError ApplySyncChanges( |
| 50 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, | 50 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, |
| 51 syncer::EntityChangeList entity_changes) override; | 51 syncer::EntityChangeList entity_changes) override; |
| 52 void GetData(StorageKeyList storage_keys, DataCallback callback) override; | 52 void GetData(StorageKeyList storage_keys, DataCallback callback) override; |
| 53 void GetAllData(DataCallback callback) override; | 53 void GetAllData(DataCallback callback) override; |
| 54 // Generate a tag that uniquely identifies |entity_data| across all data | 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 | 55 // types. This is used to identify the entity on the server. The format, which |
| 56 // must remain the same for server compatibility, is: | 56 // must remain the same for server compatibility, is: |
| 57 // "autofill_entry|$name|$value" where $name and $value are escaped. | 57 // "autofill_entry|$name|$value" where $name and $value are escaped. |
| 58 std::string GetClientTag(const syncer::EntityData& entity_data) override; | 58 std::string GetClientTag(const syncer::EntityData& entity_data) override; |
| 59 // Generate a string key uniquely identifying |entity_data| in the context of | 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" | 60 // local storage. The format, which should stay the same, is $name|$value" |
| 61 // where $name and $value are escaped. | 61 // where $name and $value are escaped. |
| 62 std::string GetStorageKey(const syncer::EntityData& entity_data) override; | 62 std::string GetStorageKey(const syncer::EntityData& entity_data) override; |
| 63 | 63 |
| 64 // Provides a StartSyncFlare to the ModelTypeSyncBridge. See sync_start_util | |
| 65 // for more. | |
| 66 void InjectStartSyncFlare( | |
| 67 const syncer::ModelTypeSyncBridge::StartSyncFlare& flare); | |
|
maxbogue
2017/01/12 01:33:36
Since we are inside a ModelTypeSyncBridge implemen
Patrick Noland
2017/01/13 23:31:52
n/a now that flare is gone
| |
| 68 | |
| 64 // AutofillWebDataServiceObserverOnDBThread implementation. | 69 // AutofillWebDataServiceObserverOnDBThread implementation. |
| 65 void AutofillEntriesChanged(const AutofillChangeList& changes) override; | 70 void AutofillEntriesChanged(const AutofillChangeList& changes) override; |
| 66 | 71 |
| 67 static AutofillEntry CreateAutofillEntry( | |
| 68 const sync_pb::AutofillSpecifics& autofill_specifics); | |
| 69 | |
| 70 private: | 72 private: |
| 71 // Returns the table associated with the |web_data_backend_|. | 73 // Returns the table associated with the |web_data_backend_|. |
| 72 AutofillTable* GetAutofillTable() const; | 74 AutofillTable* GetAutofillTable() const; |
| 73 | 75 |
| 74 std::string GetStorageKeyFromAutofillEntry( | 76 std::string GetStorageKeyFromModel(const AutofillKey& key); |
|
maxbogue
2017/01/12 01:33:35
Make static and put below ActOnChanges. Might not
Patrick Noland
2017/01/13 23:31:52
n/a now that unit tests don't use it
| |
| 75 const autofill::AutofillEntry& entry); | |
| 76 | 77 |
| 77 static std::string FormatStorageKey(const std::string& name, | 78 void ActOnChanges(const AutofillChangeList& changes); |
|
maxbogue
2017/01/12 01:33:36
comment + also rename to something with "local" in
| |
| 78 const std::string& value); | |
| 79 | 79 |
| 80 base::ThreadChecker thread_checker_; | 80 base::ThreadChecker thread_checker_; |
| 81 | 81 |
| 82 // AutocompleteSyncBridge is owned by |web_data_backend_| through | 82 // AutocompleteSyncBridge is owned by |web_data_backend_| through |
| 83 // SupportsUserData, so it's guaranteed to outlive |this|. | 83 // SupportsUserData, so it's guaranteed to outlive |this|. |
| 84 AutofillWebDataBackend* const web_data_backend_; | 84 AutofillWebDataBackend* const web_data_backend_; |
| 85 | 85 |
| 86 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> | 86 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> |
| 87 scoped_observer_; | 87 scoped_observer_; |
| 88 | |
| 89 syncer::ModelTypeSyncBridge::StartSyncFlare flare_; | |
|
maxbogue
2017/01/12 01:33:36
omit "syncer::ModelTypeSyncBridge::"
Patrick Noland
2017/01/13 23:31:52
n/a now that flare is gone
| |
| 90 | |
| 91 friend class AutocompleteSyncBridgeTest; | |
|
maxbogue
2017/01/12 01:33:36
Friend things are always the first things under "p
skym
2017/01/12 18:49:16
I was hoping you'd be able to remove the friend cl
Patrick Noland
2017/01/13 23:31:52
n/a now that flare is gone
Patrick Noland
2017/01/13 23:31:52
n/a now that flare is gone
| |
| 92 FRIEND_TEST_ALL_PREFIXES(AutocompleteSyncBridgeTest, GetStorageKeyFromModel); | |
|
maxbogue
2017/01/12 01:33:36
GetStorageKeyFromModel is not the name of a test c
Patrick Noland
2017/01/13 23:31:52
n/a now that flare is gone
| |
| 88 }; | 93 }; |
| 89 | 94 |
| 90 } // namespace autofill | 95 } // namespace autofill |
| 91 | 96 |
| 92 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ | 97 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ |
| OLD | NEW |