Commit 6ad3cc47 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Commit Bot

[Payment Handler] CanMakePaymentEvent.respondWithMinimalUI() #6

Patch #6: Remove an unnecessary layer of methods for firing the
"canmakepayment" event on Android.

Bug: 1005076
Change-Id: Ia943f24e2e0931b80e7e31dd347411aab57b5748
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2080197Reviewed-by: default avatarDanyao Wang <danyao@chromium.org>
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746404}
parent 499cadd6
...@@ -162,10 +162,13 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface ...@@ -162,10 +162,13 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface
} }
} }
fireCanMakePaymentEvent(webContents, registrationId, scope, ServiceWorkerPaymentAppBridgeJni.get().fireCanMakePaymentEvent(webContents,
mDelegate.getParams().getId(), mDelegate.getParams().getTopLevelOrigin(), registrationId, scope, mDelegate.getParams().getId(),
mDelegate.getParams().getPaymentRequestOrigin(), supportedRequestedMethodData, mDelegate.getParams().getTopLevelOrigin(),
supportedRequestedModifiers, /*callback=*/this, app); mDelegate.getParams().getPaymentRequestOrigin(),
supportedRequestedMethodData.toArray(new PaymentMethodData[0]),
supportedRequestedModifiers.toArray(new PaymentDetailsModifier[0]),
/*callback=*/this, app);
} }
/** Called when an installable payment handler is found. */ /** Called when an installable payment handler is found. */
...@@ -284,34 +287,6 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface ...@@ -284,34 +287,6 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface
ServiceWorkerPaymentAppBridgeJni.get().getServiceWorkerPaymentAppsInfo(callback); ServiceWorkerPaymentAppBridgeJni.get().getServiceWorkerPaymentAppsInfo(callback);
} }
/**
* Returns whether the app can make a payment.
*
* @param webContents The web contents that invoked PaymentRequest.
* @param registrationId The service worker registration ID of the Payment App.
* @param swScope The service worker scope.
* @param paymentRequestId The payment request identifier.
* @param origin The origin of this merchant.
* @param iframeOrigin The origin of the iframe that invoked PaymentRequest. Same as origin
* if PaymentRequest was not invoked from inside an iframe.
* @param methodData The PaymentMethodData objects that are relevant for this payment
* app.
* @param modifiers Payment method specific modifiers to the payment items and the total.
* @param callback Called after the payment app is finished running.
* @param app The payment handler where the event is being fired.
*/
private static void fireCanMakePaymentEvent(WebContents webContents, long registrationId,
String swScope, String paymentRequestId, String origin, String iframeOrigin,
Set<PaymentMethodData> methodData, Set<PaymentDetailsModifier> modifiers,
PaymentHandlerFinder callback, ServiceWorkerPaymentApp app) {
ThreadUtils.assertOnUiThread();
ServiceWorkerPaymentAppBridgeJni.get().fireCanMakePaymentEvent(webContents, registrationId,
swScope, paymentRequestId, origin, iframeOrigin,
methodData.toArray(new PaymentMethodData[0]),
modifiers.toArray(new PaymentDetailsModifier[0]), callback, app);
}
/** /**
* Make canMakePayment() return true always for testing purpose. * Make canMakePayment() return true always for testing purpose.
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment