OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVICE_H
_ | 4 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVICE_H
_ |
5 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVICE_H
_ | 5 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVICE_H
_ |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/gtest_prod_util.h" | |
15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
16 #include "base/scoped_observer.h" | 15 #include "base/scoped_observer.h" |
17 #include "base/supports_user_data.h" | 16 #include "base/supports_user_data.h" |
18 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
19 #include "components/autofill/core/browser/webdata/autofill_change.h" | 18 #include "components/autofill/core/browser/webdata/autofill_change.h" |
20 #include "components/autofill/core/browser/webdata/autofill_entry.h" | 19 #include "components/autofill/core/browser/webdata/autofill_entry.h" |
21 #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" | 20 #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" |
22 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
23 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" | 22 #include "components/autofill/core/browser/webdata/autofill_webdata_service_obse
rver.h" |
24 #include "sync/api/sync_change.h" | 23 #include "sync/api/sync_change.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 virtual bool LoadAutofillData(std::vector<AutofillEntry>* entries) const; | 93 virtual bool LoadAutofillData(std::vector<AutofillEntry>* entries) const; |
95 | 94 |
96 // Helper to persist any changes that occured during model association to | 95 // Helper to persist any changes that occured during model association to |
97 // the WebDatabase. |entries| will be either added or updated. | 96 // the WebDatabase. |entries| will be either added or updated. |
98 // Made virtual for ease of mocking in the unit-test. | 97 // Made virtual for ease of mocking in the unit-test. |
99 virtual bool SaveChangesToWebData(const std::vector<AutofillEntry>& entries); | 98 virtual bool SaveChangesToWebData(const std::vector<AutofillEntry>& entries); |
100 | 99 |
101 private: | 100 private: |
102 friend class ::FakeServerUpdater; | 101 friend class ::FakeServerUpdater; |
103 friend class ::ProfileSyncServiceAutofillTest; | 102 friend class ::ProfileSyncServiceAutofillTest; |
104 FRIEND_TEST_ALL_PREFIXES(AutocompleteSyncableServiceTest, | |
105 MergeDataAndStartSyncing); | |
106 FRIEND_TEST_ALL_PREFIXES(AutocompleteSyncableServiceTest, GetAllSyncData); | |
107 FRIEND_TEST_ALL_PREFIXES(AutocompleteSyncableServiceTest, ProcessSyncChanges); | |
108 FRIEND_TEST_ALL_PREFIXES(AutocompleteSyncableServiceTest, ActOnChange); | |
109 | 103 |
110 // This is a helper map used only in Merge/Process* functions. The lifetime | 104 // This is a helper map used only in Merge/Process* functions. The lifetime |
111 // of the iterator is longer than the map object. The bool in the pair is used | 105 // of the iterator is longer than the map object. The bool in the pair is used |
112 // to indicate if the item needs to be added (true) or updated (false). | 106 // to indicate if the item needs to be added (true) or updated (false). |
113 typedef std::map<AutofillKey, | 107 typedef std::map<AutofillKey, |
114 std::pair<syncer::SyncChange::SyncChangeType, | 108 std::pair<syncer::SyncChange::SyncChangeType, |
115 std::vector<AutofillEntry>::iterator>> | 109 std::vector<AutofillEntry>::iterator>> |
116 AutocompleteEntryMap; | 110 AutocompleteEntryMap; |
117 | 111 |
118 // Creates or updates an autocomplete entry based on |data|. | 112 // Creates or updates an autocomplete entry based on |data|. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 scoped_ptr<syncer::SyncErrorFactory> error_handler_; | 159 scoped_ptr<syncer::SyncErrorFactory> error_handler_; |
166 | 160 |
167 syncer::SyncableService::StartSyncFlare flare_; | 161 syncer::SyncableService::StartSyncFlare flare_; |
168 | 162 |
169 DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncableService); | 163 DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncableService); |
170 }; | 164 }; |
171 | 165 |
172 } // namespace autofill | 166 } // namespace autofill |
173 | 167 |
174 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVIC
E_H_ | 168 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVIC
E_H_ |
OLD | NEW |