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

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: added tests 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/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 e413ea99d97e6ed0a127fb2d019dc89afb57e809..5224278b7f3d2bfc4c5a8cf23364ed9cf3d6112e 100644
--- a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
@@ -597,14 +597,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