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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/ShippingStrings.java

Issue 2453463004: Add support for shipping type in web payments (Closed)
Patch Set: Created 4 years, 2 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/android/java/src/org/chromium/chrome/browser/payments/ShippingStrings.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ShippingStrings.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ShippingStrings.java
new file mode 100644
index 0000000000000000000000000000000000000000..56afb84671590d9c67cdbeb70116543960dea7e7
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ShippingStrings.java
@@ -0,0 +1,84 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.payments;
+
+import org.chromium.chrome.R;
+import org.chromium.payments.mojom.PaymentShippingType;
+
+/** Container for custom shipping strings. */
+public class ShippingStrings {
+ private final int mSummaryLabel;
+ private final int mAddressLabel;
+ private final int mOptionLabel;
+ private final int mSelectPrompt;
+ private final int mUnsupported;
+
+ /**
+ * Determines the strings to be used for the given shipping type.
+ *
+ * @param shippingType Shipping type. One of SHIPPING, DELIVERY, and PICKUP.
+ */
+ public ShippingStrings(int shippingType) {
+ switch (shippingType) {
+ case PaymentShippingType.SHIPPING:
+ mSummaryLabel = R.string.payments_shipping_summary_label;
+ mAddressLabel = R.string.payments_shipping_address_label;
+ mOptionLabel = R.string.payments_shipping_option_label;
+ mSelectPrompt = R.string.payments_select_shipping_address_for_shipping_methods;
+ mUnsupported = R.string.payments_unsupported_shipping_address;
+ break;
+
+ case PaymentShippingType.DELIVERY:
+ mSummaryLabel = R.string.payments_delivery_summary_label;
+ mAddressLabel = R.string.payments_delivery_address_label;
+ mOptionLabel = R.string.payments_delivery_option_label;
+ mSelectPrompt = R.string.payments_select_delivery_address_for_delivery_methods;
+ mUnsupported = R.string.payments_unsupported_delivery_address;
+ break;
+
+ case PaymentShippingType.PICKUP:
+ mSummaryLabel = R.string.payments_pickup_summary_label;
+ mAddressLabel = R.string.payments_pickup_address_label;
+ mOptionLabel = R.string.payments_pickup_option_label;
+ mSelectPrompt = R.string.payments_select_pickup_address_for_pickup_methods;
+ mUnsupported = R.string.payments_unsupported_pickup_address;
+ break;
+
+ default:
+ assert false;
+ mSummaryLabel = 0;
+ mAddressLabel = 0;
+ mOptionLabel = 0;
+ mSelectPrompt = 0;
+ mUnsupported = 0;
+ break;
+ }
+ }
+
+ /** @return The string resource for the label of shipping summary section. */
+ public int getSummaryLabel() {
+ return mSummaryLabel;
+ }
+
+ /** @return The string resource for the label of shipping address section. */
+ public int getAddressLabel() {
+ return mAddressLabel;
+ }
+
+ /** @return The string resource for the label of shipping option section. */
+ public int getOptionLabel() {
+ return mOptionLabel;
+ }
+
+ /** @return The string resource for the prompt to choose a shipping address. */
+ public int getSelectPrompt() {
+ return mSelectPrompt;
+ }
+
+ /** @return The string resource for the unsupported shipping address message. */
+ public int getUnsupported() {
+ return mUnsupported;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698