| 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/sequence_checker.h" |
| 16 #include "base/supports_user_data.h" | 17 #include "base/supports_user_data.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/model/sync_change.h" | 23 #include "components/sync/model/sync_change.h" |
| 24 #include "components/sync/model/sync_data.h" | 24 #include "components/sync/model/sync_data.h" |
| 25 #include "components/sync/model/sync_error.h" | 25 #include "components/sync/model/sync_error.h" |
| 26 #include "components/sync/model/syncable_service.h" | 26 #include "components/sync/model/syncable_service.h" |
| 27 | 27 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 42 | 42 |
| 43 class AutofillTable; | 43 class AutofillTable; |
| 44 | 44 |
| 45 // The sync implementation for autocomplete. | 45 // The sync implementation for autocomplete. |
| 46 // MergeDataAndStartSyncing() called first, it does cloud->local and | 46 // MergeDataAndStartSyncing() called first, it does cloud->local and |
| 47 // local->cloud syncs. Then for each cloud change we receive | 47 // local->cloud syncs. Then for each cloud change we receive |
| 48 // ProcessSyncChanges() and for each local change Observe() is called. | 48 // ProcessSyncChanges() and for each local change Observe() is called. |
| 49 class AutocompleteSyncableService | 49 class AutocompleteSyncableService |
| 50 : public base::SupportsUserData::Data, | 50 : public base::SupportsUserData::Data, |
| 51 public syncer::SyncableService, | 51 public syncer::SyncableService, |
| 52 public AutofillWebDataServiceObserverOnDBThread, | 52 public AutofillWebDataServiceObserverOnDBThread { |
| 53 public base::NonThreadSafe { | |
| 54 public: | 53 public: |
| 55 ~AutocompleteSyncableService() override; | 54 ~AutocompleteSyncableService() override; |
| 56 | 55 |
| 57 // Creates a new AutocompleteSyncableService and hangs it off of | 56 // Creates a new AutocompleteSyncableService and hangs it off of |
| 58 // |web_data_service|, which takes ownership. | 57 // |web_data_service|, which takes ownership. |
| 59 static void CreateForWebDataServiceAndBackend( | 58 static void CreateForWebDataServiceAndBackend( |
| 60 AutofillWebDataService* web_data_service, | 59 AutofillWebDataService* web_data_service, |
| 61 AutofillWebDataBackend* web_data_backend); | 60 AutofillWebDataBackend* web_data_backend); |
| 62 | 61 |
| 63 // Retrieves the AutocompleteSyncableService stored on |web_data_service|. | 62 // Retrieves the AutocompleteSyncableService stored on |web_data_service|. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // We receive ownership of |sync_processor_| in MergeDataAndStartSyncing() and | 154 // We receive ownership of |sync_processor_| in MergeDataAndStartSyncing() and |
| 156 // destroy it in StopSyncing(). | 155 // destroy it in StopSyncing(). |
| 157 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; | 156 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; |
| 158 | 157 |
| 159 // We receive ownership of |error_handler_| in MergeDataAndStartSyncing() and | 158 // We receive ownership of |error_handler_| in MergeDataAndStartSyncing() and |
| 160 // destroy it in StopSyncing(). | 159 // destroy it in StopSyncing(). |
| 161 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; | 160 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; |
| 162 | 161 |
| 163 syncer::SyncableService::StartSyncFlare flare_; | 162 syncer::SyncableService::StartSyncFlare flare_; |
| 164 | 163 |
| 164 SEQUENCE_CHECKER(sequence_checker_); |
| 165 |
| 165 DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncableService); | 166 DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncableService); |
| 166 }; | 167 }; |
| 167 | 168 |
| 168 } // namespace autofill | 169 } // namespace autofill |
| 169 | 170 |
| 170 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVIC
E_H_ | 171 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNCABLE_SERVIC
E_H_ |
| OLD | NEW |