| 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 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" | 5 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" | 8 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" |
| 9 #include "chrome/browser/sync/glue/do_optimistic_refresh_task.h" | 9 #include "chrome/browser/sync/glue/do_optimistic_refresh_task.h" |
| 10 #include "chrome/browser/sync/profile_sync_service.h" | 10 #include "chrome/browser/sync/profile_sync_service.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (!web_database_->GetAutoFillProfiles(profiles)) | 122 if (!web_database_->GetAutoFillProfiles(profiles)) |
| 123 return false; | 123 return false; |
| 124 | 124 |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 | 127 |
| 128 bool AutofillProfileModelAssociator::AssociateModels() { | 128 bool AutofillProfileModelAssociator::AssociateModels() { |
| 129 VLOG(1) << "Associating Autofill Models"; | 129 VLOG(1) << "Associating Autofill Models"; |
| 130 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 130 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 131 { | 131 { |
| 132 AutoLock lock(abort_association_pending_lock_); | 132 base::AutoLock lock(abort_association_pending_lock_); |
| 133 abort_association_pending_ = false; | 133 abort_association_pending_ = false; |
| 134 } | 134 } |
| 135 | 135 |
| 136 ScopedVector<AutoFillProfile> profiles; | 136 ScopedVector<AutoFillProfile> profiles; |
| 137 | 137 |
| 138 if (!LoadAutofillData(&profiles.get())) { | 138 if (!LoadAutofillData(&profiles.get())) { |
| 139 LOG(ERROR) << "Could not get the autofill data from WebDatabase."; | 139 LOG(ERROR) << "Could not get the autofill data from WebDatabase."; |
| 140 return false; | 140 return false; |
| 141 } | 141 } |
| 142 | 142 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 451 } |
| 452 | 452 |
| 453 int64 AutofillProfileModelAssociator::GetSyncIdFromChromeId( | 453 int64 AutofillProfileModelAssociator::GetSyncIdFromChromeId( |
| 454 const std::string& autofill) { | 454 const std::string& autofill) { |
| 455 AutofillToSyncIdMap::const_iterator iter = id_map_.find(autofill); | 455 AutofillToSyncIdMap::const_iterator iter = id_map_.find(autofill); |
| 456 return iter == id_map_.end() ? sync_api::kInvalidId : iter->second; | 456 return iter == id_map_.end() ? sync_api::kInvalidId : iter->second; |
| 457 } | 457 } |
| 458 | 458 |
| 459 void AutofillProfileModelAssociator::AbortAssociation() { | 459 void AutofillProfileModelAssociator::AbortAssociation() { |
| 460 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 460 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 461 AutoLock lock(abort_association_pending_lock_); | 461 base::AutoLock lock(abort_association_pending_lock_); |
| 462 abort_association_pending_ = true; | 462 abort_association_pending_ = true; |
| 463 } | 463 } |
| 464 | 464 |
| 465 const std::string* AutofillProfileModelAssociator::GetChromeNodeFromSyncId( | 465 const std::string* AutofillProfileModelAssociator::GetChromeNodeFromSyncId( |
| 466 int64 sync_id) { | 466 int64 sync_id) { |
| 467 SyncIdToAutofillMap::const_iterator iter = id_map_inverse_.find(sync_id); | 467 SyncIdToAutofillMap::const_iterator iter = id_map_inverse_.find(sync_id); |
| 468 return iter == id_map_inverse_.end() ? NULL : &(iter->second); | 468 return iter == id_map_inverse_.end() ? NULL : &(iter->second); |
| 469 } | 469 } |
| 470 | 470 |
| 471 bool AutofillProfileModelAssociator::IsAbortPending() { | 471 bool AutofillProfileModelAssociator::IsAbortPending() { |
| 472 AutoLock lock(abort_association_pending_lock_); | 472 base::AutoLock lock(abort_association_pending_lock_); |
| 473 return abort_association_pending_; | 473 return abort_association_pending_; |
| 474 } | 474 } |
| 475 | 475 |
| 476 } // namespace browser_sync | 476 } // namespace browser_sync |
| 477 | 477 |
| OLD | NEW |