| 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/macros.h" |
| 11 #include "base/optional.h" | 12 #include "base/optional.h" |
| 12 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
| 13 #include "base/supports_user_data.h" | 14 #include "base/supports_user_data.h" |
| 14 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
| 15 #include "components/autofill/core/browser/webdata/autofill_change.h" | 16 #include "components/autofill/core/browser/webdata/autofill_change.h" |
| 16 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" | 17 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" |
| 17 #include "components/sync/model/metadata_change_list.h" | 18 #include "components/sync/model/metadata_change_list.h" |
| 18 #include "components/sync/model/model_error.h" | 19 #include "components/sync/model/model_error.h" |
| 19 #include "components/sync/model/model_type_sync_bridge.h" | 20 #include "components/sync/model/model_type_sync_bridge.h" |
| 20 | 21 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // "autofill_entry|$name|$value" where $name and $value are escaped. | 59 // "autofill_entry|$name|$value" where $name and $value are escaped. |
| 59 std::string GetClientTag(const syncer::EntityData& entity_data) override; | 60 std::string GetClientTag(const syncer::EntityData& entity_data) override; |
| 60 // 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 |
| 61 // 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" |
| 62 // where $name and $value are escaped. | 63 // where $name and $value are escaped. |
| 63 std::string GetStorageKey(const syncer::EntityData& entity_data) override; | 64 std::string GetStorageKey(const syncer::EntityData& entity_data) override; |
| 64 | 65 |
| 65 // AutofillWebDataServiceObserverOnDBThread implementation. | 66 // AutofillWebDataServiceObserverOnDBThread implementation. |
| 66 void AutofillEntriesChanged(const AutofillChangeList& changes) override; | 67 void AutofillEntriesChanged(const AutofillChangeList& changes) override; |
| 67 | 68 |
| 68 static AutofillEntry CreateAutofillEntry( | |
| 69 const sync_pb::AutofillSpecifics& autofill_specifics); | |
| 70 | |
| 71 private: | 69 private: |
| 72 // Returns the table associated with the |web_data_backend_|. | 70 // Returns the table associated with the |web_data_backend_|. |
| 73 AutofillTable* GetAutofillTable() const; | 71 AutofillTable* GetAutofillTable() const; |
| 74 | 72 |
| 75 std::string GetStorageKeyFromAutofillEntry( | 73 std::string GetStorageKeyFromAutofillEntry( |
| 76 const autofill::AutofillEntry& entry); | 74 const autofill::AutofillEntry& entry); |
| 77 | 75 |
| 78 static std::string FormatStorageKey(const std::string& name, | 76 static std::string FormatStorageKey(const std::string& name, |
| 79 const std::string& value); | 77 const std::string& value); |
| 80 | 78 |
| 81 base::ThreadChecker thread_checker_; | 79 base::ThreadChecker thread_checker_; |
| 82 | 80 |
| 83 // AutocompleteSyncBridge is owned by |web_data_backend_| through | 81 // AutocompleteSyncBridge is owned by |web_data_backend_| through |
| 84 // SupportsUserData, so it's guaranteed to outlive |this|. | 82 // SupportsUserData, so it's guaranteed to outlive |this|. |
| 85 AutofillWebDataBackend* const web_data_backend_; | 83 AutofillWebDataBackend* const web_data_backend_; |
| 86 | 84 |
| 87 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> | 85 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> |
| 88 scoped_observer_; | 86 scoped_observer_; |
| 87 |
| 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_ |
| OLD | NEW |