| 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 |
| 11 #include "base/optional.h" |
| 11 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
| 12 #include "base/supports_user_data.h" | 13 #include "base/supports_user_data.h" |
| 13 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 14 #include "components/autofill/core/browser/webdata/autofill_change.h" | 15 #include "components/autofill/core/browser/webdata/autofill_change.h" |
| 15 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" | 16 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" |
| 16 #include "components/sync/model/metadata_change_list.h" | 17 #include "components/sync/model/metadata_change_list.h" |
| 17 #include "components/sync/model/model_error.h" | 18 #include "components/sync/model/model_error.h" |
| 18 #include "components/sync/model/model_type_sync_bridge.h" | 19 #include "components/sync/model/model_type_sync_bridge.h" |
| 19 | 20 |
| 20 namespace autofill { | 21 namespace autofill { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 static void CreateForWebDataServiceAndBackend( | 37 static void CreateForWebDataServiceAndBackend( |
| 37 AutofillWebDataService* web_data_service, | 38 AutofillWebDataService* web_data_service, |
| 38 AutofillWebDataBackend* web_data_backend); | 39 AutofillWebDataBackend* web_data_backend); |
| 39 | 40 |
| 40 static AutocompleteSyncBridge* FromWebDataService( | 41 static AutocompleteSyncBridge* FromWebDataService( |
| 41 AutofillWebDataService* web_data_service); | 42 AutofillWebDataService* web_data_service); |
| 42 | 43 |
| 43 // syncer::ModelTypeService implementation. | 44 // syncer::ModelTypeService implementation. |
| 44 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList() | 45 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList() |
| 45 override; | 46 override; |
| 46 syncer::ModelError MergeSyncData( | 47 base::Optional<syncer::ModelError> MergeSyncData( |
| 47 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, | 48 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, |
| 48 syncer::EntityDataMap entity_data_map) override; | 49 syncer::EntityDataMap entity_data_map) override; |
| 49 syncer::ModelError ApplySyncChanges( | 50 base::Optional<syncer::ModelError> ApplySyncChanges( |
| 50 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, | 51 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, |
| 51 syncer::EntityChangeList entity_changes) override; | 52 syncer::EntityChangeList entity_changes) override; |
| 52 void GetData(StorageKeyList storage_keys, DataCallback callback) override; | 53 void GetData(StorageKeyList storage_keys, DataCallback callback) override; |
| 53 void GetAllData(DataCallback callback) override; | 54 void GetAllData(DataCallback callback) override; |
| 54 // Generate a tag that uniquely identifies |entity_data| across all data | 55 // 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 // types. This is used to identify the entity on the server. The format, which |
| 56 // must remain the same for server compatibility, is: | 57 // must remain the same for server compatibility, is: |
| 57 // "autofill_entry|$name|$value" where $name and $value are escaped. | 58 // "autofill_entry|$name|$value" where $name and $value are escaped. |
| 58 std::string GetClientTag(const syncer::EntityData& entity_data) override; | 59 std::string GetClientTag(const syncer::EntityData& entity_data) override; |
| 59 // Generate a string key uniquely identifying |entity_data| in the context of | 60 // Generate a string key uniquely identifying |entity_data| in the context of |
| (...skipping 23 matching lines...) Expand all Loading... |
| 83 // SupportsUserData, so it's guaranteed to outlive |this|. | 84 // SupportsUserData, so it's guaranteed to outlive |this|. |
| 84 AutofillWebDataBackend* const web_data_backend_; | 85 AutofillWebDataBackend* const web_data_backend_; |
| 85 | 86 |
| 86 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> | 87 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> |
| 87 scoped_observer_; | 88 scoped_observer_; |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 } // namespace autofill | 91 } // namespace autofill |
| 91 | 92 |
| 92 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ | 93 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ |
| OLD | NEW |