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

Unified Diff: chrome/browser/ui/views/payments/profile_list_view_controller.cc

Issue 2847503002: [WebPayments] Show labels on incomplete profiles (Closed)
Patch Set: add missing changes Created 3 years, 8 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: chrome/browser/ui/views/payments/profile_list_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/profile_list_view_controller.cc b/chrome/browser/ui/views/payments/profile_list_view_controller.cc
index 4ff1043c45bdb0e6bf5fdfcbf0e32de94fead136..80406eca86706b3f37e7dfc834c55ea55b898ed1 100644
--- a/chrome/browser/ui/views/payments/profile_list_view_controller.cc
+++ b/chrome/browser/ui/views/payments/profile_list_view_controller.cc
@@ -11,6 +11,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/payments/content/payment_request_spec.h"
#include "components/payments/content/payment_request_state.h"
+#include "components/payments/core/profile_util.h"
#include "components/payments/core/strings_util.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
@@ -75,9 +76,7 @@ class ProfileItem : public PaymentRequestItemList::Item {
}
bool CanBeSelected() const override {
- // TODO(crbug.com/709454): Check for profile completeness. Currently a giant
- // hack to test the UI.
- return !profile_->GetRawInfo(autofill::ADDRESS_HOME_ZIP).empty();
+ return parent_view_->IsValidProfile(*profile_);
}
void PerformSelectionFallback() override {
@@ -108,7 +107,8 @@ class ShippingProfileViewController : public ProfileListViewController {
std::unique_ptr<views::View> GetLabel(
autofill::AutofillProfile* profile) override {
return GetShippingAddressLabel(AddressStyleType::DETAILED,
- state()->GetApplicationLocale(), *profile);
+ state()->GetApplicationLocale(), *profile,
+ *spec(), *(state()->profile_comparator()));
}
void SelectProfile(autofill::AutofillProfile* profile) override {
@@ -130,6 +130,10 @@ class ShippingProfileViewController : public ProfileListViewController {
return state()->selected_shipping_profile();
}
+ bool IsValidProfile(const autofill::AutofillProfile& profile) override {
+ return state()->profile_comparator()->IsShippingComplete(&profile);
+ }
+
std::vector<autofill::AutofillProfile*> GetProfiles() override {
return state()->shipping_profiles();
}
@@ -175,7 +179,7 @@ class ContactProfileViewController : public ProfileListViewController {
autofill::AutofillProfile* profile) override {
return GetContactInfoLabel(AddressStyleType::DETAILED,
state()->GetApplicationLocale(), *profile,
- *spec());
+ *spec(), *(state()->profile_comparator()));
}
void SelectProfile(autofill::AutofillProfile* profile) override {
@@ -190,6 +194,10 @@ class ContactProfileViewController : public ProfileListViewController {
return state()->selected_contact_profile();
}
+ bool IsValidProfile(const autofill::AutofillProfile& profile) override {
+ return state()->profile_comparator()->IsContactInfoComplete(&profile);
+ }
+
std::vector<autofill::AutofillProfile*> GetProfiles() override {
return state()->contact_profiles();
}

Powered by Google App Engine
This is Rietveld 408576698