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

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

Issue 2969713002: [Payments] Present web payment app instead of instruments to user (Closed)
Patch Set: address comments Created 3 years, 5 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 99c8d7c52e848fe78964de651cb9fd98e0519900..c6e377ef8dc60ae1db7a968c2e69fe9496664a2e 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
@@ -16,9 +16,6 @@ import org.chromium.payments.mojom.PaymentDetailsModifier;
import org.chromium.payments.mojom.PaymentItem;
import org.chromium.payments.mojom.PaymentMethodData;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import javax.annotation.Nullable;
@@ -50,38 +47,15 @@ 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 instrumentId The ID of the PaymentInstrument that was selected by the user.
* @param callback Called after the payment app is finished running.
*/
public static void invokePaymentApp(WebContents webContents, long registrationId, String origin,
String iframeOrigin, String paymentRequestId, Set<PaymentMethodData> methodData,
- PaymentItem total, Set<PaymentDetailsModifier> modifiers, String instrumentId,
+ PaymentItem total, Set<PaymentDetailsModifier> modifiers,
PaymentInstrument.InstrumentDetailsCallback callback) {
nativeInvokePaymentApp(webContents, registrationId, origin, iframeOrigin, paymentRequestId,
methodData.toArray(new PaymentMethodData[0]), total,
- modifiers.toArray(new PaymentDetailsModifier[0]), instrumentId, callback);
- }
-
- @CalledByNative
- private static List<PaymentInstrument> createInstrumentList() {
- return new ArrayList<PaymentInstrument>();
- }
-
- @CalledByNative
- private static void addInstrument(List<PaymentInstrument> instruments, WebContents webContents,
- long swRegistrationId, String instrumentId, String label, String[] methodNameArray,
- @Nullable Bitmap icon) {
- Context context = ChromeActivity.fromWebContents(webContents);
- if (context == null) return;
-
- Set<String> methodNames = new HashSet<String>();
- for (int i = 0; i < methodNameArray.length; i++) {
- methodNames.add(methodNameArray[i]);
- }
-
- instruments.add(new ServiceWorkerPaymentInstrument(webContents, swRegistrationId,
- instrumentId, label, methodNames,
- icon == null ? null : new BitmapDrawable(context.getResources(), icon)));
+ modifiers.toArray(new PaymentDetailsModifier[0]), callback);
}
@CalledByNative
@@ -120,11 +94,16 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactory.PaymentA
}
@CalledByNative
- private static void onPaymentAppCreated(
- List<PaymentInstrument> instruments, WebContents webContents, Object callback) {
+ private static void onPaymentAppCreated(long registrationId, String label,
+ @Nullable Bitmap icon, String[] methodNameArray, WebContents webContents,
+ Object callback) {
assert callback instanceof PaymentAppFactory.PaymentAppCreatedCallback;
+ Context context = ChromeActivity.fromWebContents(webContents);
+ if (context == null) return;
((PaymentAppFactory.PaymentAppCreatedCallback) callback)
- .onPaymentAppCreated(new ServiceWorkerPaymentApp(webContents, instruments));
+ .onPaymentAppCreated(new ServiceWorkerPaymentApp(webContents, registrationId, label,
+ icon == null ? null : new BitmapDrawable(context.getResources(), icon),
+ methodNameArray));
}
@CalledByNative
@@ -160,5 +139,5 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactory.PaymentA
private static native void nativeInvokePaymentApp(WebContents webContents, long registrationId,
String topLevelOrigin, String paymentRequestOrigin, String paymentRequestId,
PaymentMethodData[] methodData, PaymentItem total, PaymentDetailsModifier[] modifiers,
- String instrumentKey, Object callback);
+ Object callback);
}

Powered by Google App Engine
This is Rietveld 408576698