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

Unified Diff: components/payments/core/payments_profile_comparator.h

Issue 2884393002: [WebPayments] Adding FilterProfilesForShipping to profile comparator (Closed)
Patch Set: rebase 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
Index: components/payments/core/payments_profile_comparator.h
diff --git a/components/payments/core/payments_profile_comparator.h b/components/payments/core/payments_profile_comparator.h
index 2c8b934ad81204400dce0073105f89cc2a351ac7..e186e05efad34969007fa9198fb58d7049a07e35 100644
--- a/components/payments/core/payments_profile_comparator.h
+++ b/components/payments/core/payments_profile_comparator.h
@@ -71,21 +71,25 @@ class PaymentsProfileComparator : public autofill::AutofillProfileComparator {
// |profile|.
bool IsContactInfoComplete(const autofill::AutofillProfile* profile) const;
- // Comparison function suitable for sorting profiles by contact completeness
- // score with std::sort.
- bool IsContactMoreComplete(const autofill::AutofillProfile* p1,
- const autofill::AutofillProfile* p2) const;
+ // Returns profiles for shipping, ordered by completeness. |profiles| should
+ // be passed in order of frecency, and this order will be preserved among
+ // equally-complete profiles.
+ std::vector<autofill::AutofillProfile*> FilterProfilesForShipping(
+ const std::vector<autofill::AutofillProfile*>& profiles) const;
- // Returns a localized string to be displayed in UI indicating what action,
- // if any, must be taken for the given profile to be used as contact info.
- base::string16 GetStringForMissingContactFields(
- const autofill::AutofillProfile& profile) const;
+ int GetShippingCompletenessScore(
+ const autofill::AutofillProfile* profile) const;
// Returns true iff every field needed to use |profile| as a shipping address
// is populated.
bool IsShippingComplete(const autofill::AutofillProfile* profile) const;
// Returns a localized string to be displayed in UI indicating what action,
+ // if any, must be taken for the given profile to be used as contact info.
+ base::string16 GetStringForMissingContactFields(
+ const autofill::AutofillProfile& profile) const;
+
+ // Returns a localized string to be displayed in UI indicating what action,
// if any, must be taken for the given profile to be used as a shipping
// address.
base::string16 GetStringForMissingShippingFields(
@@ -103,6 +107,14 @@ class PaymentsProfileComparator : public autofill::AutofillProfileComparator {
base::string16 GetStringForMissingFields(ProfileFields fields) const;
bool AreRequiredAddressFieldsPresent(
const autofill::AutofillProfile& profile) const;
+
+ // Comparison functions suitable for sorting profiles by completeness
+ // score with std::sort.
+ bool IsContactMoreComplete(const autofill::AutofillProfile* p1,
+ const autofill::AutofillProfile* p2) const;
+ bool IsShippingMoreComplete(const autofill::AutofillProfile* p1,
+ const autofill::AutofillProfile* p2) const;
+
mutable std::map<std::string, ProfileFields> cache_;
const PaymentOptionsProvider& options_;
};
« no previous file with comments | « components/payments/content/payment_request_state.cc ('k') | components/payments/core/payments_profile_comparator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698