| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_SYNC_GLUE_AUTOFILL_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_AUTOFILL_MODEL_ASSOCIATOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_MODEL_ASSOCIATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Contains all model association related logic: | 42 // Contains all model association related logic: |
| 43 // * Algorithm to associate autofill model and sync model. | 43 // * Algorithm to associate autofill model and sync model. |
| 44 // We do not check if we have local data before this run; we always | 44 // We do not check if we have local data before this run; we always |
| 45 // merge and sync. | 45 // merge and sync. |
| 46 class AutofillModelAssociator | 46 class AutofillModelAssociator |
| 47 : public PerDataTypeAssociatorInterface<std::string, std::string> { | 47 : public PerDataTypeAssociatorInterface<std::string, std::string> { |
| 48 public: | 48 public: |
| 49 static syncable::ModelType model_type() { return syncable::AUTOFILL; } | 49 static syncable::ModelType model_type() { return syncable::AUTOFILL; } |
| 50 AutofillModelAssociator(ProfileSyncService* sync_service, | 50 AutofillModelAssociator(ProfileSyncService* sync_service, |
| 51 WebDatabase* web_database, | 51 WebDatabase* web_database, |
| 52 PersonalDataManager* data_manager, | 52 PersonalDataManager* data_manager); |
| 53 UnrecoverableErrorHandler* error_handler); | |
| 54 virtual ~AutofillModelAssociator(); | 53 virtual ~AutofillModelAssociator(); |
| 55 | 54 |
| 56 // A task used by this class and the change processor to inform the | 55 // A task used by this class and the change processor to inform the |
| 57 // PersonalDataManager living on the UI thread that it needs to refresh. | 56 // PersonalDataManager living on the UI thread that it needs to refresh. |
| 58 class DoOptimisticRefreshTask : public Task { | 57 class DoOptimisticRefreshTask : public Task { |
| 59 public: | 58 public: |
| 60 explicit DoOptimisticRefreshTask(PersonalDataManager* pdm) : pdm_(pdm) {} | 59 explicit DoOptimisticRefreshTask(PersonalDataManager* pdm) : pdm_(pdm) {} |
| 61 virtual void Run() { | 60 virtual void Run() { |
| 62 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 61 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 63 pdm_->Refresh(); | 62 pdm_->Refresh(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const AutoFillProfile& profile, | 196 const AutoFillProfile& profile, |
| 198 int64* sync_id); | 197 int64* sync_id); |
| 199 | 198 |
| 200 // Called at various points in model association to determine if the | 199 // Called at various points in model association to determine if the |
| 201 // user requested an abort. | 200 // user requested an abort. |
| 202 bool IsAbortPending(); | 201 bool IsAbortPending(); |
| 203 | 202 |
| 204 ProfileSyncService* sync_service_; | 203 ProfileSyncService* sync_service_; |
| 205 WebDatabase* web_database_; | 204 WebDatabase* web_database_; |
| 206 PersonalDataManager* personal_data_; | 205 PersonalDataManager* personal_data_; |
| 207 UnrecoverableErrorHandler* error_handler_; | |
| 208 int64 autofill_node_id_; | 206 int64 autofill_node_id_; |
| 209 | 207 |
| 210 AutofillToSyncIdMap id_map_; | 208 AutofillToSyncIdMap id_map_; |
| 211 SyncIdToAutofillMap id_map_inverse_; | 209 SyncIdToAutofillMap id_map_inverse_; |
| 212 | 210 |
| 213 // Abort association pending flag and lock. If this is set to true | 211 // Abort association pending flag and lock. If this is set to true |
| 214 // (via the AbortAssociation method), return from the | 212 // (via the AbortAssociation method), return from the |
| 215 // AssociateModels method as soon as possible. | 213 // AssociateModels method as soon as possible. |
| 216 Lock abort_association_pending_lock_; | 214 Lock abort_association_pending_lock_; |
| 217 bool abort_association_pending_; | 215 bool abort_association_pending_; |
| 218 | 216 |
| 219 DISALLOW_COPY_AND_ASSIGN(AutofillModelAssociator); | 217 DISALLOW_COPY_AND_ASSIGN(AutofillModelAssociator); |
| 220 }; | 218 }; |
| 221 | 219 |
| 222 } // namespace browser_sync | 220 } // namespace browser_sync |
| 223 | 221 |
| 224 #endif // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_MODEL_ASSOCIATOR_H_ | 222 #endif // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |