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

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

Issue 2640743005: PaymentApp: Implement invokePaymentApp for Android (Closed)
Patch Set: Fix a compile error Created 3 years, 11 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/ServiceWorkerPaymentAppBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java
index 72dbc39e940e23d1f44b4f3042afa6b1981a7bff..2847444ee3a399eea9d313aa7a72d53d3e47bc5d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java
@@ -10,6 +10,8 @@ import android.graphics.drawable.Drawable;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.content_public.browser.WebContents;
+import org.chromium.payments.mojom.PaymentDetailsModifier;
+import org.chromium.payments.mojom.PaymentItem;
import org.chromium.payments.mojom.PaymentMethodData;
import java.util.ArrayList;
@@ -67,13 +69,17 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactory.PaymentA
* @param webContents The web contents that invoked PaymentRequest.
* @param registrationId The service worker registration ID of the Payment App.
* @param optionId The ID of the PaymentOption that was selected by the user.
- * @param methodDataSet The PaymentMethodData objects that are relevant for this payment
- * app.
+ * @param methodData The PaymentMethodData objects that are relevant for this payment
+ * app.
+ * @param total The PaymentItem that represents the total cost of the payment.
+ * @param modifiers Payment method specific modifiers to the payment items and the total.
*/
public static void invokePaymentApp(WebContents webContents, long registrationId,
- String optionId, Set<PaymentMethodData> methodDataSet) {
- nativeInvokePaymentApp(webContents, registrationId, optionId,
- methodDataSet.toArray(new PaymentMethodData[methodDataSet.size()]));
+ String optionId, String origin, Set<PaymentMethodData> methodData, PaymentItem total,
+ List<PaymentItem> displayItems, Set<PaymentDetailsModifier> modifiers) {
+ nativeInvokePaymentApp(webContents, registrationId, optionId, origin,
+ methodData.toArray(new PaymentMethodData[0]), total,
+ modifiers.toArray(new PaymentDetailsModifier[0]));
}
@CalledByNative
@@ -104,6 +110,41 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactory.PaymentA
}
@CalledByNative
+ private static String[] getSupportedMethodsFromMethodData(PaymentMethodData data) {
+ return data.supportedMethods;
+ }
+
+ @CalledByNative
+ private static String getStringifiedDataFromMethodData(PaymentMethodData data) {
+ return data.stringifiedData;
+ }
+
+ @CalledByNative
+ private static PaymentMethodData getMethodDataFromModifier(PaymentDetailsModifier modifier) {
+ return modifier.methodData;
+ }
+
+ @CalledByNative
+ private static PaymentItem getTotalFromModifier(PaymentDetailsModifier modifier) {
+ return modifier.total;
+ }
+
+ @CalledByNative
+ private static String getLabelFromPaymentItem(PaymentItem item) {
+ return item.label;
+ }
+
+ @CalledByNative
+ private static String getCurrencyFromPaymentItem(PaymentItem item) {
+ return item.amount.currency;
+ }
+
+ @CalledByNative
+ private static String getValueFromPaymentItem(PaymentItem item) {
+ return item.amount.value;
+ }
+
+ @CalledByNative
private static void onGotManifest(Manifest manifest, WebContents webContents, Object callback) {
assert callback instanceof PaymentAppFactory.PaymentAppCreatedCallback;
((PaymentAppFactory.PaymentAppCreatedCallback) callback)
@@ -124,5 +165,6 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactory.PaymentA
private static native void nativeGetAllAppManifests(WebContents webContents, Object callback);
private static native void nativeInvokePaymentApp(WebContents webContents, long registrationId,
- String optionId, PaymentMethodData[] methodData);
+ String optionId, String origin, PaymentMethodData[] methodData, PaymentItem total,
+ PaymentDetailsModifier[] modifiers);
}

Powered by Google App Engine
This is Rietveld 408576698