Index: components/payments/payment_request.cc |
diff --git a/components/payments/payment_request.cc b/components/payments/payment_request.cc |
index d7302df59c70c7fcda437a4df50d89570d0d376a..8a47f65de8a33cf3ed9416e455814f462650b1b4 100644 |
--- a/components/payments/payment_request.cc |
+++ b/components/payments/payment_request.cc |
@@ -120,23 +120,11 @@ const std::vector<autofill::AutofillProfile*>& |
return contact_profiles_; |
} |
-autofill::CreditCard* PaymentRequest::GetCurrentlySelectedCreditCard() { |
- // TODO(anthonyvd): Change this code to prioritize server cards and implement |
- // a way to modify this function's return value. |
+const std::vector<autofill::CreditCard*> PaymentRequest::credit_cards() { |
autofill::PersonalDataManager* data_manager = |
delegate_->GetPersonalDataManager(); |
- const std::vector<autofill::CreditCard*> cards = |
- data_manager->GetCreditCardsToSuggest(); |
- |
- auto first_complete_card = std::find_if( |
- cards.begin(), |
- cards.end(), |
- [] (autofill::CreditCard* card) { |
- return card->IsValid(); |
- }); |
- |
- return first_complete_card == cards.end() ? nullptr : *first_complete_card; |
+ return data_manager->GetCreditCardsToSuggest(); |
please use gerrit instead
2017/02/14 00:29:14
These cards are owned by data_manager and can chan
anthonyvd
2017/02/22 20:15:21
Ahh, didn't know that! Done. I imagine we'll need
|
} |
void PaymentRequest::PopulateProfileCache() { |
@@ -165,6 +153,19 @@ void PaymentRequest::SetDefaultProfileSelections() { |
if (!contact_profiles().empty()) |
set_selected_contact_profile(contact_profiles()[0]); |
+ |
+ // TODO(anthonyvd): Change this code to prioritize server cards and implement |
+ // a way to modify this function's return value. |
+ const std::vector<autofill::CreditCard*> cards = credit_cards(); |
+ auto first_complete_card = std::find_if( |
+ cards.begin(), |
+ cards.end(), |
+ [] (autofill::CreditCard* card) { |
+ return card->IsValid(); |
+ }); |
+ |
+ selected_credit_card_ = |
+ first_complete_card == cards.end() ?nullptr : *first_complete_card; |
please use gerrit instead
2017/02/14 00:29:14
need space after "?"
anthonyvd
2017/02/22 20:15:21
Done.
|
} |
} // namespace payments |