OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/personal_data_manager.h" | 5 #include "components/autofill/core/browser/personal_data_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 // clear so that tests can synchronously verify that this data was cleared. | 686 // clear so that tests can synchronously verify that this data was cleared. |
687 server_credit_cards_.clear(); | 687 server_credit_cards_.clear(); |
688 server_profiles_.clear(); | 688 server_profiles_.clear(); |
689 } | 689 } |
690 | 690 |
691 void PersonalDataManager::AddServerCreditCardForTest( | 691 void PersonalDataManager::AddServerCreditCardForTest( |
692 std::unique_ptr<CreditCard> credit_card) { | 692 std::unique_ptr<CreditCard> credit_card) { |
693 server_credit_cards_.push_back(credit_card.release()); | 693 server_credit_cards_.push_back(credit_card.release()); |
694 } | 694 } |
695 | 695 |
| 696 void PersonalDataManager::UpdateCreditCardForTest( |
| 697 const CreditCard& credit_card) { |
| 698 if (credit_card.record_type() == CreditCard::LOCAL_CARD) |
| 699 database_->UpdateCreditCard(credit_card); |
| 700 else |
| 701 database_->UpdateServerCardUsageStats(credit_card); |
| 702 } |
| 703 |
| 704 void PersonalDataManager::UpdateProfileForTest(const AutofillProfile& profile) { |
| 705 if (profile.record_type() == AutofillProfile::LOCAL_PROFILE) |
| 706 database_->UpdateAutofillProfile(profile); |
| 707 else if (profile.record_type() == AutofillProfile::SERVER_PROFILE) |
| 708 database_->UpdateServerAddressUsageStats(profile); |
| 709 } |
| 710 |
696 void PersonalDataManager::RemoveByGUID(const std::string& guid) { | 711 void PersonalDataManager::RemoveByGUID(const std::string& guid) { |
697 if (is_off_the_record_) | 712 if (is_off_the_record_) |
698 return; | 713 return; |
699 | 714 |
700 bool is_credit_card = FindByGUID<CreditCard>(local_credit_cards_, guid); | 715 bool is_credit_card = FindByGUID<CreditCard>(local_credit_cards_, guid); |
701 bool is_profile = !is_credit_card && | 716 bool is_profile = !is_credit_card && |
702 FindByGUID<AutofillProfile>(web_profiles_, guid); | 717 FindByGUID<AutofillProfile>(web_profiles_, guid); |
703 if (!is_credit_card && !is_profile) | 718 if (!is_credit_card && !is_profile) |
704 return; | 719 return; |
705 | 720 |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 if (profile_to_merge->IsVerified()) | 1771 if (profile_to_merge->IsVerified()) |
1757 break; | 1772 break; |
1758 } | 1773 } |
1759 } | 1774 } |
1760 } | 1775 } |
1761 AutofillMetrics::LogNumberOfProfilesRemovedDuringDedupe( | 1776 AutofillMetrics::LogNumberOfProfilesRemovedDuringDedupe( |
1762 profiles_to_delete->size()); | 1777 profiles_to_delete->size()); |
1763 } | 1778 } |
1764 | 1779 |
1765 } // namespace autofill | 1780 } // namespace autofill |
OLD | NEW |