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

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

Issue 2866063004: payment app android
Patch Set: payment app android 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.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/ServiceWorkerPaymentApp.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentApp.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentApp.java
index 93b007b9ceb0eb1ab43031b95dd456ae643af101..76ddc6e203eb54e50c1acaf52d560ced30c18daf 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentApp.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentApp.java
@@ -9,7 +9,6 @@ import android.os.Handler;
import org.chromium.content_public.browser.WebContents;
import org.chromium.payments.mojom.PaymentMethodData;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -26,7 +25,7 @@ import java.util.Set;
*/
public class ServiceWorkerPaymentApp implements PaymentApp {
private final WebContents mWebContents;
- private final ServiceWorkerPaymentAppBridge.Manifest mManifest;
+ private final List<PaymentInstrument> mInstruments;
private final Set<String> mMethodNames;
/**
@@ -37,14 +36,13 @@ public class ServiceWorkerPaymentApp implements PaymentApp {
* @param webContents The web contents where PaymentRequest was invoked.
* @param manifest A manifest that describes this payment app.
*/
- public ServiceWorkerPaymentApp(
- WebContents webContents, ServiceWorkerPaymentAppBridge.Manifest manifest) {
+ public ServiceWorkerPaymentApp(WebContents webContents, List<PaymentInstrument> instruments) {
mWebContents = webContents;
- mManifest = manifest;
+ mInstruments = instruments;
mMethodNames = new HashSet<>();
- for (ServiceWorkerPaymentAppBridge.Option option : manifest.options) {
- mMethodNames.addAll(option.enabledMethods);
+ for (PaymentInstrument instrument : instruments) {
+ mMethodNames.addAll(instrument.getInstrumentMethodNames());
}
}
@@ -52,18 +50,10 @@ public class ServiceWorkerPaymentApp implements PaymentApp {
public void getInstruments(Map<String, PaymentMethodData> unusedMethodDataMap,
String unusedOrigin, String unusedIFrameOrigin, byte[][] unusedCertificateChain,
final InstrumentsCallback callback) {
- final List<PaymentInstrument> instruments =
- new ArrayList<PaymentInstrument>();
-
- for (ServiceWorkerPaymentAppBridge.Option option : mManifest.options) {
- instruments.add(new ServiceWorkerPaymentInstrument(
- mWebContents, mManifest.registrationId, option));
- }
-
new Handler().post(new Runnable() {
@Override
public void run() {
- callback.onInstrumentsReady(ServiceWorkerPaymentApp.this, instruments);
+ callback.onInstrumentsReady(ServiceWorkerPaymentApp.this, mInstruments);
}
});
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698