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 "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
9 #include "base/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // AutofillWebDataServiceObserverOnDBThread implementation. | 64 // AutofillWebDataServiceObserverOnDBThread implementation. |
65 void AutofillEntriesChanged(const AutofillChangeList& changes) override; | 65 void AutofillEntriesChanged(const AutofillChangeList& changes) override; |
66 | 66 |
67 private: | 67 private: |
| 68 friend class AutocompleteSyncBridgeTest; |
| 69 |
68 // Returns the table associated with the |web_data_backend_|. | 70 // Returns the table associated with the |web_data_backend_|. |
69 AutofillTable* GetAutofillTable() const; | 71 AutofillTable* GetAutofillTable() const; |
70 | 72 |
| 73 std::string GetStorageKeyFromAutofillEntry( |
| 74 const autofill::AutofillEntry& entry); |
| 75 |
| 76 static std::string FormatStorageKey(const std::string& name, |
| 77 const std::string& value); |
| 78 |
| 79 static AutofillEntry CreateAutofillEntry( |
| 80 const sync_pb::AutofillSpecifics& autofill_specifics); |
| 81 |
71 base::ThreadChecker thread_checker_; | 82 base::ThreadChecker thread_checker_; |
72 | 83 |
73 // AutocompleteSyncBridge is owned by |web_data_backend_| through | 84 // AutocompleteSyncBridge is owned by |web_data_backend_| through |
74 // SupportsUserData, so it's guaranteed to outlive |this|. | 85 // SupportsUserData, so it's guaranteed to outlive |this|. |
75 AutofillWebDataBackend* const web_data_backend_; | 86 AutofillWebDataBackend* const web_data_backend_; |
76 | 87 |
77 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> | 88 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> |
78 scoped_observer_; | 89 scoped_observer_; |
79 }; | 90 }; |
80 | 91 |
81 } // namespace autofill | 92 } // namespace autofill |
82 | 93 |
83 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ | 94 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ |
OLD | NEW |