Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 2894943002: Prevent existing card number to be used for new credit cards in the Payment Request (Closed)
Patch Set: Merge fluke fix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 (const auto& credit_card : GetCreditCards()) {
770 if (credit_card->HasSameNumberAs(numbered_card))
771 return credit_card;
772 }
773 return nullptr;
774 }
775
765 void PersonalDataManager::GetNonEmptyTypes( 776 void PersonalDataManager::GetNonEmptyTypes(
766 ServerFieldTypeSet* non_empty_types) { 777 ServerFieldTypeSet* non_empty_types) {
767 for (AutofillProfile* profile : GetProfiles()) 778 for (AutofillProfile* profile : GetProfiles())
768 profile->GetNonEmptyTypes(app_locale_, non_empty_types); 779 profile->GetNonEmptyTypes(app_locale_, non_empty_types);
769 for (CreditCard* card : GetCreditCards()) 780 for (CreditCard* card : GetCreditCards())
770 card->GetNonEmptyTypes(app_locale_, non_empty_types); 781 card->GetNonEmptyTypes(app_locale_, non_empty_types);
771 } 782 }
772 783
773 bool PersonalDataManager::IsDataLoaded() const { 784 bool PersonalDataManager::IsDataLoaded() const {
774 return is_data_loaded_; 785 return is_data_loaded_;
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 existing_profiles->back().SetRawInfo(EMAIL_ADDRESS, email); 2075 existing_profiles->back().SetRawInfo(EMAIL_ADDRESS, email);
2065 2076
2066 AutofillMetrics::LogWalletAddressConversionType( 2077 AutofillMetrics::LogWalletAddressConversionType(
2067 AutofillMetrics::CONVERTED_ADDRESS_ADDED); 2078 AutofillMetrics::CONVERTED_ADDRESS_ADDED);
2068 } 2079 }
2069 2080
2070 return guid; 2081 return guid;
2071 } 2082 }
2072 2083
2073 } // namespace autofill 2084 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698