Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/scoped_observer.h" | 15 #include "base/scoped_observer.h" |
| 16 #include "base/supports_user_data.h" | 16 #include "base/supports_user_data.h" |
| 17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
| 18 #include "components/autofill/core/browser/webdata/autofill_change.h" | 18 #include "components/autofill/core/browser/webdata/autofill_change.h" |
| 19 #include "components/autofill/core/browser/webdata/autofill_entry.h" | 19 #include "components/autofill/core/browser/webdata/autofill_entry.h" |
| 20 #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" | 20 #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" |
| 21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 22 #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" |
| 23 #include "components/sync/api/sync_change.h" | 23 #include "components/sync/api/sync_change.h" |
| 24 #include "components/sync/api/sync_data.h" | 24 #include "components/sync/api/sync_data.h" |
| 25 #include "components/sync/api/sync_error.h" | 25 #include "components/sync/api/sync_error.h" |
| 26 #include "components/sync/api/syncable_service.h" | 26 #include "components/sync/api/syncable_service.h" |
| 27 | 27 |
| 28 namespace browser_sync { | |
| 28 class FakeServerUpdater; | 29 class FakeServerUpdater; |
| 29 class ProfileSyncServiceAutofillTest; | 30 class ProfileSyncServiceAutofillTest; |
| 31 } | |
|
skym
2016/09/22 17:25:59
Closing namespaces.
maxbogue
2016/09/22 19:41:15
Done.
| |
| 30 | 32 |
| 31 namespace syncer { | 33 namespace syncer { |
| 32 class SyncErrorFactory; | 34 class SyncErrorFactory; |
| 33 } | 35 } |
| 34 | 36 |
| 35 namespace sync_pb { | 37 namespace sync_pb { |
| 36 class AutofillSpecifics; | 38 class AutofillSpecifics; |
| 37 } | 39 } |
| 38 | 40 |
| 39 namespace autofill { | 41 namespace autofill { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 // Helper to query WebDatabase for the current autocomplete state. | 93 // Helper to query WebDatabase for the current autocomplete state. |
| 92 // Made virtual for ease of mocking in the unit-test. | 94 // Made virtual for ease of mocking in the unit-test. |
| 93 virtual bool LoadAutofillData(std::vector<AutofillEntry>* entries) const; | 95 virtual bool LoadAutofillData(std::vector<AutofillEntry>* entries) const; |
| 94 | 96 |
| 95 // Helper to persist any changes that occured during model association to | 97 // Helper to persist any changes that occured during model association to |
| 96 // the WebDatabase. |entries| will be either added or updated. | 98 // the WebDatabase. |entries| will be either added or updated. |
| 97 // Made virtual for ease of mocking in the unit-test. | 99 // Made virtual for ease of mocking in the unit-test. |
| 98 virtual bool SaveChangesToWebData(const std::vector<AutofillEntry>& entries); | 100 virtual bool SaveChangesToWebData(const std::vector<AutofillEntry>& entries); |
| 99 | 101 |
| 100 private: | 102 private: |
| 101 friend class ::FakeServerUpdater; | 103 friend class browser_sync::FakeServerUpdater; |
| 102 friend class ::ProfileSyncServiceAutofillTest; | 104 friend class browser_sync::ProfileSyncServiceAutofillTest; |
| 103 | 105 |
| 104 // This is a helper map used only in Merge/Process* functions. The lifetime | 106 // This is a helper map used only in Merge/Process* functions. The lifetime |
| 105 // of the iterator is longer than the map object. The bool in the pair is used | 107 // of the iterator is longer than the map object. The bool in the pair is used |
| 106 // to indicate if the item needs to be added (true) or updated (false). | 108 // to indicate if the item needs to be added (true) or updated (false). |
| 107 typedef std::map<AutofillKey, | 109 typedef std::map<AutofillKey, |
| 108 std::pair<syncer::SyncChange::SyncChangeType, | 110 std::pair<syncer::SyncChange::SyncChangeType, |
| 109 std::vector<AutofillEntry>::iterator>> | 111 std::vector<AutofillEntry>::iterator>> |
| 110 AutocompleteEntryMap; | 112 AutocompleteEntryMap; |
| 111 | 113 |
| 112 // Creates or updates an autocomplete entry based on |data|. | 114 // Creates or updates an autocomplete entry based on |data|. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; | 161 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; |
| 160 | 162 |
| 161 syncer::SyncableService::StartSyncFlare flare_; | 163 syncer::SyncableService::StartSyncFlare flare_; |
| 162 | 164 |
| 163 DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncableService); | 165 DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncableService); |
| 164 }; | 166 }; |
| 165 | 167 |
| 166 } // namespace autofill | 168 } // namespace autofill |
| 167 | 169 |
| 168 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVIC E_H_ | 170 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVIC E_H_ |
| OLD | NEW |