| 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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 Refresh(); | 755 Refresh(); |
| 756 } | 756 } |
| 757 | 757 |
| 758 CreditCard* PersonalDataManager::GetCreditCardByGUID(const std::string& guid) { | 758 CreditCard* PersonalDataManager::GetCreditCardByGUID(const std::string& guid) { |
| 759 const std::vector<CreditCard*>& credit_cards = GetCreditCards(); | 759 const std::vector<CreditCard*>& credit_cards = GetCreditCards(); |
| 760 std::vector<CreditCard*>::const_iterator iter = | 760 std::vector<CreditCard*>::const_iterator iter = |
| 761 FindElementByGUID<CreditCard>(credit_cards, guid); | 761 FindElementByGUID<CreditCard>(credit_cards, guid); |
| 762 return iter != credit_cards.end() ? *iter : nullptr; | 762 return iter != credit_cards.end() ? *iter : nullptr; |
| 763 } | 763 } |
| 764 | 764 |
| 765 CreditCard* PersonalDataManager::GetCreditCardByNumber( |
| 766 const std::string& number) { |
| 767 CreditCard numbered_card; |
| 768 numbered_card.SetNumber(base::ASCIIToUTF16(number)); |
| 769 for (CreditCard* credit_card : GetCreditCards()) { |
| 770 DCHECK(credit_card); |
| 771 if (credit_card->HasSameNumberAs(numbered_card)) |
| 772 return credit_card; |
| 773 } |
| 774 return nullptr; |
| 775 } |
| 776 |
| 765 void PersonalDataManager::GetNonEmptyTypes( | 777 void PersonalDataManager::GetNonEmptyTypes( |
| 766 ServerFieldTypeSet* non_empty_types) { | 778 ServerFieldTypeSet* non_empty_types) { |
| 767 for (AutofillProfile* profile : GetProfiles()) | 779 for (AutofillProfile* profile : GetProfiles()) |
| 768 profile->GetNonEmptyTypes(app_locale_, non_empty_types); | 780 profile->GetNonEmptyTypes(app_locale_, non_empty_types); |
| 769 for (CreditCard* card : GetCreditCards()) | 781 for (CreditCard* card : GetCreditCards()) |
| 770 card->GetNonEmptyTypes(app_locale_, non_empty_types); | 782 card->GetNonEmptyTypes(app_locale_, non_empty_types); |
| 771 } | 783 } |
| 772 | 784 |
| 773 bool PersonalDataManager::IsDataLoaded() const { | 785 bool PersonalDataManager::IsDataLoaded() const { |
| 774 return is_data_loaded_; | 786 return is_data_loaded_; |
| (...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2064 existing_profiles->back().SetRawInfo(EMAIL_ADDRESS, email); | 2076 existing_profiles->back().SetRawInfo(EMAIL_ADDRESS, email); |
| 2065 | 2077 |
| 2066 AutofillMetrics::LogWalletAddressConversionType( | 2078 AutofillMetrics::LogWalletAddressConversionType( |
| 2067 AutofillMetrics::CONVERTED_ADDRESS_ADDED); | 2079 AutofillMetrics::CONVERTED_ADDRESS_ADDED); |
| 2068 } | 2080 } |
| 2069 | 2081 |
| 2070 return guid; | 2082 return guid; |
| 2071 } | 2083 } |
| 2072 | 2084 |
| 2073 } // namespace autofill | 2085 } // namespace autofill |
| OLD | NEW |