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

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

Issue 2867273003: PaymentHandler: Replace GetAllManifests() with GetAllPaymentApps(). (Closed)
Patch Set: rebased Created 3 years, 7 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/ServiceWorkerPaymentInstrument.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentInstrument.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentInstrument.java
index bdd2c2f5528d817f6d6f3ed0c14fa8331b4125e0..722c8519c776eab3078a452ceee4b00cc45a8be3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentInstrument.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentInstrument.java
@@ -16,38 +16,38 @@ import java.util.Map;
import java.util.Set;
/**
- * This instrument class represents a single payment option for a service
+ * This instrument class represents a single payment instrument for a service
* worker based payment app.
*
* @see org.chromium.chrome.browser.payments.ServiceWorkerPaymentApp
*
- * @see https://w3c.github.io/webpayments-payment-apps-api/
+ * @see https://w3c.github.io/webpayments-payment-handler/
*/
public class ServiceWorkerPaymentInstrument extends PaymentInstrument {
private final WebContents mWebContents;
- private final long mAppRegistrationId;
- private final ServiceWorkerPaymentAppBridge.Option mOption;
+ private final long mSWRegistrationId;
+ private final String mInstrumentId;
private final Set<String> mMethodNames;
/**
- * Build a service worker based payment instrument based on a single payment option
- * of an installed payment app.
+ * Build a service worker based payment instrument.
*
* @see https://w3c.github.io/webpayments-payment-apps-api/#payment-app-options
*
* @param webContents The web contents where PaymentRequest was invoked.
- * @param appRegistrationId The registration id of the corresponding service worker payment app.
- * @param option A payment app option from the payment app.
+ * @param swRegistrationId The registration id of the corresponding service worker payment app.
+ * @param instrumentId The unique id of the payment instrument.
+ * @param label The label of the payment instrument.
+ * @param methodNames A set of payment method names supported by the payment instrument.
*/
- public ServiceWorkerPaymentInstrument(WebContents webContents, long appRegistrationId,
- ServiceWorkerPaymentAppBridge.Option option) {
- super(Long.toString(appRegistrationId) + "#" + option.id, option.label, null /* icon */,
- option.icon);
+ public ServiceWorkerPaymentInstrument(WebContents webContents, long swRegistrationId,
+ String instrumentId, String label, Set<String> methodNames) {
+ super(Long.toString(swRegistrationId) + "#" + instrumentId, label, null /* sublabel */,
+ null /* icon */);
mWebContents = webContents;
- mAppRegistrationId = appRegistrationId;
- mOption = option;
-
- mMethodNames = new HashSet<String>(option.enabledMethods);
+ mSWRegistrationId = swRegistrationId;
+ mInstrumentId = instrumentId;
+ mMethodNames = methodNames;
}
@Override
@@ -60,9 +60,9 @@ public class ServiceWorkerPaymentInstrument extends PaymentInstrument {
byte[][] unusedCertificateChain, Map<String, PaymentMethodData> methodData,
PaymentItem total, List<PaymentItem> displayItems,
Map<String, PaymentDetailsModifier> modifiers, InstrumentDetailsCallback callback) {
- ServiceWorkerPaymentAppBridge.invokePaymentApp(mWebContents, mAppRegistrationId, mOption.id,
- origin, iframeOrigin, new HashSet<>(methodData.values()), total, displayItems,
- new HashSet<>(modifiers.values()), callback);
+ ServiceWorkerPaymentAppBridge.invokePaymentApp(mWebContents, mSWRegistrationId,
+ mInstrumentId, origin, iframeOrigin, new HashSet<>(methodData.values()), total,
+ displayItems, new HashSet<>(modifiers.values()), callback);
}
@Override

Powered by Google App Engine
This is Rietveld 408576698