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 const std::string GetStorageKeyFromAutofillEntry( | |
skym
2016/12/19 17:40:08
Why are all these functions returning const string
Gang Wu
2016/12/19 23:28:09
Done.
| |
74 const autofill::AutofillEntry& entry); | |
75 | |
76 static const std::string FormatStorageKey(const std::string& name, | |
77 const std::string& value); | |
78 | |
79 static std::unique_ptr<syncer::EntityData> CreateEntityData( | |
80 const AutofillEntry& entry); | |
81 | |
82 static AutofillEntry CreateAutofillEntry( | |
83 const sync_pb::AutofillSpecifics* autofill_specifics); | |
skym
2016/12/19 17:40:08
Why not take a const sync_pb::AutofillSpecifics&
Gang Wu
2016/12/19 23:28:09
Done.
| |
84 | |
71 base::ThreadChecker thread_checker_; | 85 base::ThreadChecker thread_checker_; |
72 | 86 |
73 // AutocompleteSyncBridge is owned by |web_data_backend_| through | 87 // AutocompleteSyncBridge is owned by |web_data_backend_| through |
74 // SupportsUserData, so it's guaranteed to outlive |this|. | 88 // SupportsUserData, so it's guaranteed to outlive |this|. |
75 AutofillWebDataBackend* const web_data_backend_; | 89 AutofillWebDataBackend* const web_data_backend_; |
76 | 90 |
77 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> | 91 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge> |
78 scoped_observer_; | 92 scoped_observer_; |
79 }; | 93 }; |
80 | 94 |
81 } // namespace autofill | 95 } // namespace autofill |
82 | 96 |
83 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ | 97 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ |
OLD | NEW |