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/profile_sync_service.h" | 8 #include "chrome/browser/sync/profile_sync_service.h" |
9 #include "chrome/browser/webdata/web_database.h" | 9 #include "chrome/browser/webdata/web_database.h" |
10 | 10 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 void AutofillProfileModelAssociator::Disassociate(int64 sync_id) { | 344 void AutofillProfileModelAssociator::Disassociate(int64 sync_id) { |
345 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 345 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
346 SyncIdToAutofillMap::iterator iter = id_map_inverse_.find(sync_id); | 346 SyncIdToAutofillMap::iterator iter = id_map_inverse_.find(sync_id); |
347 if (iter == id_map_inverse_.end()) | 347 if (iter == id_map_inverse_.end()) |
348 return; | 348 return; |
349 CHECK(id_map_.erase(iter->second)); | 349 CHECK(id_map_.erase(iter->second)); |
350 id_map_inverse_.erase(iter); | 350 id_map_inverse_.erase(iter); |
351 } | 351 } |
352 | 352 |
353 int64 AutofillProfileModelAssociator::GetSyncIdFromChromeId( | 353 int64 AutofillProfileModelAssociator::GetSyncIdFromChromeId( |
354 const std::string autofill) { | 354 const std::string& autofill) { |
355 AutofillToSyncIdMap::const_iterator iter = id_map_.find(autofill); | 355 AutofillToSyncIdMap::const_iterator iter = id_map_.find(autofill); |
356 return iter == id_map_.end() ? sync_api::kInvalidId : iter->second; | 356 return iter == id_map_.end() ? sync_api::kInvalidId : iter->second; |
357 } | 357 } |
358 | 358 |
359 void AutofillProfileModelAssociator::AbortAssociation() { | 359 void AutofillProfileModelAssociator::AbortAssociation() { |
360 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 360 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
361 AutoLock lock(abort_association_pending_lock_); | 361 AutoLock lock(abort_association_pending_lock_); |
362 abort_association_pending_ = true; | 362 abort_association_pending_ = true; |
363 } | 363 } |
364 | 364 |
365 bool AutofillProfileModelAssociator::IsAbortPending() { | 365 bool AutofillProfileModelAssociator::IsAbortPending() { |
366 AutoLock lock(abort_association_pending_lock_); | 366 AutoLock lock(abort_association_pending_lock_); |
367 return abort_association_pending_; | 367 return abort_association_pending_; |
368 } | 368 } |
369 | 369 |
370 } // namespace browser_sync | 370 } // namespace browser_sync |
371 | 371 |
OLD | NEW |