| 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 <set> | 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <utility> | 11 #include <utility> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.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 "sync/api/sync_change.h" | 23 #include "sync/api/sync_change.h" |
| 24 #include "sync/api/sync_data.h" | 24 #include "sync/api/sync_data.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Retrieves the AutocompleteSyncableService stored on |web_data_service|. | 61 // Retrieves the AutocompleteSyncableService stored on |web_data_service|. |
| 62 static AutocompleteSyncableService* FromWebDataService( | 62 static AutocompleteSyncableService* FromWebDataService( |
| 63 AutofillWebDataService* web_data_service); | 63 AutofillWebDataService* web_data_service); |
| 64 | 64 |
| 65 static syncer::ModelType model_type() { return syncer::AUTOFILL; } | 65 static syncer::ModelType model_type() { return syncer::AUTOFILL; } |
| 66 | 66 |
| 67 // syncer::SyncableService: | 67 // syncer::SyncableService: |
| 68 syncer::SyncMergeResult MergeDataAndStartSyncing( | 68 syncer::SyncMergeResult MergeDataAndStartSyncing( |
| 69 syncer::ModelType type, | 69 syncer::ModelType type, |
| 70 const syncer::SyncDataList& initial_sync_data, | 70 const syncer::SyncDataList& initial_sync_data, |
| 71 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 71 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 72 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | 72 std::unique_ptr<syncer::SyncErrorFactory> error_handler) override; |
| 73 void StopSyncing(syncer::ModelType type) override; | 73 void StopSyncing(syncer::ModelType type) override; |
| 74 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; | 74 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; |
| 75 syncer::SyncError ProcessSyncChanges( | 75 syncer::SyncError ProcessSyncChanges( |
| 76 const tracked_objects::Location& from_here, | 76 const tracked_objects::Location& from_here, |
| 77 const syncer::SyncChangeList& change_list) override; | 77 const syncer::SyncChangeList& change_list) override; |
| 78 | 78 |
| 79 // AutofillWebDataServiceObserverOnDBThread: | 79 // AutofillWebDataServiceObserverOnDBThread: |
| 80 void AutofillEntriesChanged(const AutofillChangeList& changes) override; | 80 void AutofillEntriesChanged(const AutofillChangeList& changes) override; |
| 81 | 81 |
| 82 // Provides a StartSyncFlare to the SyncableService. See sync_start_util for | 82 // Provides a StartSyncFlare to the SyncableService. See sync_start_util for |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 // The |web_data_backend_| is expected to outlive |this|. | 147 // The |web_data_backend_| is expected to outlive |this|. |
| 148 AutofillWebDataBackend* const web_data_backend_; | 148 AutofillWebDataBackend* const web_data_backend_; |
| 149 | 149 |
| 150 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncableService> | 150 ScopedObserver<AutofillWebDataBackend, AutocompleteSyncableService> |
| 151 scoped_observer_; | 151 scoped_observer_; |
| 152 | 152 |
| 153 // We receive ownership of |sync_processor_| in MergeDataAndStartSyncing() and | 153 // We receive ownership of |sync_processor_| in MergeDataAndStartSyncing() and |
| 154 // destroy it in StopSyncing(). | 154 // destroy it in StopSyncing(). |
| 155 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | 155 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; |
| 156 | 156 |
| 157 // We receive ownership of |error_handler_| in MergeDataAndStartSyncing() and | 157 // We receive ownership of |error_handler_| in MergeDataAndStartSyncing() and |
| 158 // destroy it in StopSyncing(). | 158 // destroy it in StopSyncing(). |
| 159 scoped_ptr<syncer::SyncErrorFactory> error_handler_; | 159 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; |
| 160 | 160 |
| 161 syncer::SyncableService::StartSyncFlare flare_; | 161 syncer::SyncableService::StartSyncFlare flare_; |
| 162 | 162 |
| 163 DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncableService); | 163 DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncableService); |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 } // namespace autofill | 166 } // namespace autofill |
| 167 | 167 |
| 168 #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 |