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

Unified Diff: ios/chrome/browser/payments/payment_request.mm

Issue 2897133002: Revert of [WebPayments] Adding FilterProfilesForShipping to profile comparator (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/payments/core/payments_profile_comparator_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/payments/payment_request.mm
diff --git a/ios/chrome/browser/payments/payment_request.mm b/ios/chrome/browser/payments/payment_request.mm
index 5e9683f2f8d8e20092a232a0a37239154d222a17..da4ec76873b4b2525c795d85645663b13a6fb8fc 100644
--- a/ios/chrome/browser/payments/payment_request.mm
+++ b/ios/chrome/browser/payments/payment_request.mm
@@ -128,29 +128,29 @@
return;
profile_cache_.reserve(profiles_to_suggest.size());
-
- std::vector<autofill::AutofillProfile*> raw_profiles_for_filtering;
- raw_profiles_for_filtering.reserve(profiles_to_suggest.size());
-
for (const auto* profile : profiles_to_suggest) {
profile_cache_.push_back(*profile);
- raw_profiles_for_filtering.push_back(&profile_cache_.back());
+ shipping_profiles_.push_back(&profile_cache_.back());
+ }
+
+ // If the merchant provided a shipping option, select a suitable default
+ // shipping profile. We pick the profile that is most complete, going down
+ // the list in Frecency order.
+ // TODO(crbug.com/719652): Have a proper ordering of shipping addresses by
+ // completeness.
+ if (selected_shipping_option_) {
+ selected_shipping_profile_ = shipping_profiles_[0];
+ for (autofill::AutofillProfile* profile : shipping_profiles_) {
+ if (profile_comparator_.IsShippingComplete(profile)) {
+ selected_shipping_profile_ = profile;
+ break;
+ }
+ }
}
// Contact profiles are deduped and ordered in completeness.
contact_profiles_ =
- profile_comparator_.FilterProfilesForContact(raw_profiles_for_filtering);
-
- // Shipping profiles are ordered by completeness.
- shipping_profiles_ =
- profile_comparator_.FilterProfilesForShipping(raw_profiles_for_filtering);
-
- // If the merchant provided a shipping option, and the highest-ranking
- // shipping profile is usable, select it.
- if (selected_shipping_option_ && !shipping_profiles_.empty() &&
- profile_comparator_.IsShippingComplete(shipping_profiles_[0])) {
- selected_shipping_profile_ = shipping_profiles_[0];
- }
+ profile_comparator_.FilterProfilesForContact(shipping_profiles_);
// If the highest-ranking contact profile is usable, select it. Otherwise,
// select none.
« no previous file with comments | « components/payments/core/payments_profile_comparator_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698