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

Unified Diff: components/payments/content/payment_request_spec.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
« no previous file with comments | « components/payments/content/payment_request_spec.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/payments/content/payment_request_spec.cc
diff --git a/components/payments/content/payment_request_spec.cc b/components/payments/content/payment_request_spec.cc
index 5e58552f51e8866cd314d3ba6188a7bf8e2c64d1..a5addb5c01b5be199831bdd9b144b91d9f84c47f 100644
--- a/components/payments/content/payment_request_spec.cc
+++ b/components/payments/content/payment_request_spec.cc
@@ -7,8 +7,11 @@
#include <utility>
#include "base/logging.h"
+#include "base/strings/utf_string_conversions.h"
#include "components/payments/core/payment_method_data.h"
#include "components/payments/core/payment_request_data_util.h"
+#include "components/strings/grit/components_strings.h"
+#include "ui/base/l10n/l10n_util.h"
namespace payments {
@@ -166,6 +169,7 @@ void PaymentRequestSpec::UpdateSelectedShippingOption() {
if (!request_shipping())
return;
+ selected_shipping_option_error_.clear();
// As per the spec, the selected shipping option should initially be the last
// one in the array that has its selected field set to true.
auto selected_shipping_option_it = std::find_if(
@@ -177,7 +181,12 @@ void PaymentRequestSpec::UpdateSelectedShippingOption() {
selected_shipping_option_ = selected_shipping_option_it->get();
} else {
// It's possible that there is no selected shipping option.
- // TODO(crbug.com/710004): Show an error in this case.
+ if (!details().error.empty()) {
+ selected_shipping_option_error_ = base::UTF8ToUTF16(details().error);
+ } else {
+ selected_shipping_option_error_ =
+ l10n_util::GetStringUTF16(IDS_PAYMENTS_UNSUPPORTED_SHIPPING_ADDRESS);
+ }
selected_shipping_option_ = nullptr;
}
}
« no previous file with comments | « components/payments/content/payment_request_spec.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698