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

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

Issue 2855203002: [Payments] Display the shipping option error alongside the address (Closed)
Patch Set: android test 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
index 1249aaa40b60ba57daeb47487300933d076f9ebf..e7a026788ccc98fdc2a0522550e88c6665686b55 100644
--- a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
@@ -625,14 +625,24 @@ PaymentSheetViewController::CreateShippingSectionContent() {
if (current_update_reason_ ==
PaymentRequestSpec::UpdateReason::SHIPPING_ADDRESS) {
return CreateCheckingSpinnerView();
- } else {
- auto* profile = state()->selected_shipping_profile();
+ }
- return profile
- ? GetShippingAddressLabel(
- AddressStyleType::SUMMARY, state()->GetApplicationLocale(),
- *profile, *spec(), *(state()->profile_comparator()))
- : base::MakeUnique<views::Label>(base::string16());
+ autofill::AutofillProfile* profile = state()->selected_shipping_profile();
+ if (!profile)
+ return base::MakeUnique<views::Label>(base::string16());
+
+ // If there is a shipping option error related to the selected address,
+ // display it (without disabling the row because the user should feel like
+ // they can click on it to correct the problem). Otherwise, display the
+ // address possibly with the missing information to make it complete.
+ if (!spec()->selected_shipping_option_error().empty()) {
+ return GetShippingAddressLabelWithError(
+ AddressStyleType::SUMMARY, state()->GetApplicationLocale(), *profile,
+ spec()->selected_shipping_option_error(), /*disabled_state=*/false);
+ } else {
+ return GetShippingAddressLabelWithMissingInfo(
+ AddressStyleType::SUMMARY, state()->GetApplicationLocale(), *profile,
+ *(state()->profile_comparator()));
}
}

Powered by Google App Engine
This is Rietveld 408576698