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

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

Issue 2775933002: PaymentApp: Receive payment app responses in Android (Closed)
Patch Set: Add a comment based on Rouslan's feedback 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentInstrument.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9d86584e1e452fc6ba5d2df9c94545936c82c4e2..4d41d73939cea5145210d14598763ab1ae71d8fd 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
@@ -72,14 +72,16 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactory.PaymentA
* 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.
+ * @param callback Called after the payment app is finished running.
*/
public static void invokePaymentApp(WebContents webContents, long registrationId,
String optionId, String origin, String unusedIframeOrigin,
Set<PaymentMethodData> methodData, PaymentItem total, List<PaymentItem> displayItems,
- Set<PaymentDetailsModifier> modifiers) {
+ Set<PaymentDetailsModifier> modifiers,
+ PaymentInstrument.InstrumentDetailsCallback callback) {
nativeInvokePaymentApp(webContents, registrationId, optionId, origin,
methodData.toArray(new PaymentMethodData[0]), total,
- modifiers.toArray(new PaymentDetailsModifier[0]));
+ modifiers.toArray(new PaymentDetailsModifier[0]), callback);
}
@CalledByNative
@@ -157,6 +159,18 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactory.PaymentA
((PaymentAppFactory.PaymentAppCreatedCallback) callback).onAllPaymentAppsCreated();
}
+ @CalledByNative
+ private static void onPaymentAppInvoked(
+ Object callback, String methodName, String stringifiedDetails) {
+ assert callback instanceof PaymentInstrument.InstrumentDetailsCallback;
+ if (methodName == null) {
+ ((PaymentInstrument.InstrumentDetailsCallback) callback).onInstrumentDetailsError();
+ } else {
+ ((PaymentInstrument.InstrumentDetailsCallback) callback)
+ .onInstrumentDetailsReady(methodName, stringifiedDetails);
+ }
+ }
+
/*
* TODO(tommyt): crbug.com/505554. Change the |callback| parameter below to
* be of type PaymentAppFactory.PaymentAppCreatedCallback, once this JNI bug
@@ -164,7 +178,12 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactory.PaymentA
*/
private static native void nativeGetAllAppManifests(WebContents webContents, Object callback);
+ /*
+ * TODO(tommyt): crbug.com/505554. Change the |callback| parameter below to
+ * be of type PaymentInstrument.InstrumentDetailsCallback, once this JNI bug
+ * has been resolved.
+ */
private static native void nativeInvokePaymentApp(WebContents webContents, long registrationId,
String optionId, String origin, PaymentMethodData[] methodData, PaymentItem total,
- PaymentDetailsModifier[] modifiers);
+ PaymentDetailsModifier[] modifiers, Object callback);
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentInstrument.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698