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 14 matching lines...) Expand all Loading... |
25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
26 DCHECK(sync_service_); | 26 DCHECK(sync_service_); |
27 DCHECK(web_database_); | 27 DCHECK(web_database_); |
28 DCHECK(personal_data_); | 28 DCHECK(personal_data_); |
29 } | 29 } |
30 | 30 |
31 AutofillProfileModelAssociator::~AutofillProfileModelAssociator() { | 31 AutofillProfileModelAssociator::~AutofillProfileModelAssociator() { |
32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
33 } | 33 } |
34 | 34 |
| 35 AutofillProfileModelAssociator::AutofillProfileModelAssociator() {} |
| 36 |
35 bool AutofillProfileModelAssociator::TraverseAndAssociateChromeAutoFillProfiles( | 37 bool AutofillProfileModelAssociator::TraverseAndAssociateChromeAutoFillProfiles( |
36 sync_api::WriteTransaction* write_trans, | 38 sync_api::WriteTransaction* write_trans, |
37 const sync_api::ReadNode& autofill_root, | 39 const sync_api::ReadNode& autofill_root, |
38 const std::vector<AutoFillProfile*>& all_profiles_from_db, | 40 const std::vector<AutoFillProfile*>& all_profiles_from_db, |
39 std::set<std::string>* current_profiles, | 41 std::set<std::string>* current_profiles, |
40 std::vector<AutoFillProfile*>* updated_profiles, | 42 std::vector<AutoFillProfile*>* updated_profiles, |
41 std::vector<AutoFillProfile*>* new_profiles, | 43 std::vector<AutoFillProfile*>* new_profiles, |
42 std::vector<std::string>* profiles_to_delete) { | 44 std::vector<std::string>* profiles_to_delete) { |
43 | 45 |
44 // Alias the all_profiles_from_db so we fit in 80 characters | 46 // Alias the all_profiles_from_db so we fit in 80 characters |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 325 |
324 for (size_t i = 0; i< bundle.profiles_to_delete.size(); ++i) { | 326 for (size_t i = 0; i< bundle.profiles_to_delete.size(); ++i) { |
325 if (IsAbortPending()) | 327 if (IsAbortPending()) |
326 return false; | 328 return false; |
327 if (!web_database_->RemoveAutoFillProfile(bundle.profiles_to_delete[i])) | 329 if (!web_database_->RemoveAutoFillProfile(bundle.profiles_to_delete[i])) |
328 return false; | 330 return false; |
329 } | 331 } |
330 return true; | 332 return true; |
331 } | 333 } |
332 | 334 |
| 335 const std::string* AutofillProfileModelAssociator::GetChromeNodeFromSyncId( |
| 336 int64 sync_id) { |
| 337 return NULL; |
| 338 } |
| 339 |
| 340 bool AutofillProfileModelAssociator::InitSyncNodeFromChromeId( |
| 341 const std::string& node_id, |
| 342 sync_api::BaseNode* sync_node) { |
| 343 return false; |
| 344 } |
| 345 |
| 346 bool AutofillProfileModelAssociator::GetSyncIdForTaggedNode( |
| 347 const std::string& tag, |
| 348 int64* sync_id) { |
| 349 return false; |
| 350 } |
| 351 |
333 void AutofillProfileModelAssociator::Associate( | 352 void AutofillProfileModelAssociator::Associate( |
334 const std::string* autofill, | 353 const std::string* autofill, |
335 int64 sync_id) { | 354 int64 sync_id) { |
336 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 355 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
337 DCHECK_NE(sync_api::kInvalidId, sync_id); | 356 DCHECK_NE(sync_api::kInvalidId, sync_id); |
338 DCHECK(id_map_.find(*autofill) == id_map_.end()); | 357 DCHECK(id_map_.find(*autofill) == id_map_.end()); |
339 DCHECK(id_map_inverse_.find(sync_id) == id_map_inverse_.end()); | 358 DCHECK(id_map_inverse_.find(sync_id) == id_map_inverse_.end()); |
340 id_map_[*autofill] = sync_id; | 359 id_map_[*autofill] = sync_id; |
341 id_map_inverse_[sync_id] = *autofill; | 360 id_map_inverse_[sync_id] = *autofill; |
342 } | 361 } |
(...skipping 19 matching lines...) Expand all Loading... |
362 abort_association_pending_ = true; | 381 abort_association_pending_ = true; |
363 } | 382 } |
364 | 383 |
365 bool AutofillProfileModelAssociator::IsAbortPending() { | 384 bool AutofillProfileModelAssociator::IsAbortPending() { |
366 AutoLock lock(abort_association_pending_lock_); | 385 AutoLock lock(abort_association_pending_lock_); |
367 return abort_association_pending_; | 386 return abort_association_pending_; |
368 } | 387 } |
369 | 388 |
370 } // namespace browser_sync | 389 } // namespace browser_sync |
371 | 390 |
OLD | NEW |