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

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

Issue 2742643004: [Web Payments] Use shippingType to choose the Payment Sheet shipping strings. (Closed)
Patch Set: Fix windows compile. Created 3 years, 9 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_request_views_util.cc
diff --git a/chrome/browser/ui/views/payments/payment_request_views_util.cc b/chrome/browser/ui/views/payments/payment_request_views_util.cc
index 6e110bbe539c4077867de92cee6de80ed838e7b5..62b815bab5d29159de4d5f5da1f97036321871da 100644
--- a/chrome/browser/ui/views/payments/payment_request_views_util.cc
+++ b/chrome/browser/ui/views/payments/payment_request_views_util.cc
@@ -15,7 +15,9 @@
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/credit_card.h"
#include "components/autofill/core/browser/field_types.h"
+#include "components/strings/grit/components_strings.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/font_list.h"
@@ -246,4 +248,34 @@ std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text) {
return label;
}
+base::string16 GetShippingAddressSectionString(
+ payments::mojom::PaymentShippingType shipping_type) {
+ switch (shipping_type) {
+ case payments::mojom::PaymentShippingType::DELIVERY:
+ return l10n_util::GetStringUTF16(IDS_PAYMENTS_DELIVERY_ADDRESS_LABEL);
+ case payments::mojom::PaymentShippingType::PICKUP:
+ return l10n_util::GetStringUTF16(IDS_PAYMENTS_PICKUP_ADDRESS_LABEL);
+ case payments::mojom::PaymentShippingType::SHIPPING:
+ return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_ADDRESS_LABEL);
+ }
+ // MSVC doesn't compile with only the above switch statement because it can't
+ // see that all control paths return a value.
+ return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_ADDRESS_LABEL);
+}
+
+base::string16 GetShippingOptionSectionString(
+ payments::mojom::PaymentShippingType shipping_type) {
+ switch (shipping_type) {
+ case payments::mojom::PaymentShippingType::DELIVERY:
+ return l10n_util::GetStringUTF16(IDS_PAYMENTS_DELIVERY_OPTION_LABEL);
+ case payments::mojom::PaymentShippingType::PICKUP:
+ return l10n_util::GetStringUTF16(IDS_PAYMENTS_PICKUP_OPTION_LABEL);
+ case payments::mojom::PaymentShippingType::SHIPPING:
+ return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_OPTION_LABEL);
+ }
+ // MSVC doesn't compile with only the above switch statement because it can't
+ // see that all control paths return a value.
+ return l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_OPTION_LABEL);
+}
+
} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698