| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java
|
| index 06bf964172c65de8d180ec1d4b8670dbb0d33201..2335a712c671402446002e90098354cefd89600e 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java
|
| @@ -6,7 +6,9 @@ package org.chromium.chrome.browser.payments;
|
|
|
| import android.content.Context;
|
|
|
| +import org.chromium.base.CommandLine;
|
| import org.chromium.base.VisibleForTesting;
|
| +import org.chromium.chrome.browser.ChromeSwitches;
|
| import org.chromium.content_public.browser.WebContents;
|
|
|
| import java.util.ArrayList;
|
| @@ -22,6 +24,9 @@ public class PaymentAppFactory {
|
| */
|
| private static PaymentAppFactoryAddition sAdditionalFactory;
|
|
|
| + private static ServiceWorkerPaymentAppBridge sServiceWorkerPaymentAppBridge =
|
| + new ServiceWorkerPaymentAppBridge();
|
| +
|
| /**
|
| * The interface for additional payment app factories.
|
| */
|
| @@ -54,10 +59,29 @@ public class PaymentAppFactory {
|
| public static List<PaymentApp> create(Context context, WebContents webContents) {
|
| List<PaymentApp> result = new ArrayList<>(2);
|
| result.add(new AutofillPaymentApp(context, webContents));
|
| +
|
| + if (CommandLine.getInstance().hasSwitch(
|
| + ChromeSwitches.ENABLE_SERVICE_WORKER_PAYMENT_APPS)) {
|
| + result.addAll(createServiceWorkerPaymentApps());
|
| + }
|
| +
|
| if (sAdditionalFactory != null) {
|
| result.addAll(
|
| sAdditionalFactory.create(context, webContents));
|
| }
|
| return result;
|
| }
|
| +
|
| + /**
|
| + * Build a ServiceWorkerPaymentApp instance for each installed web based
|
| + * payment app.
|
| + */
|
| + private static List<ServiceWorkerPaymentApp> createServiceWorkerPaymentApps() {
|
| + List<ServiceWorkerPaymentApp> result = new ArrayList<>();
|
| + for (ServiceWorkerPaymentAppBridge.Manifest manifest :
|
| + sServiceWorkerPaymentAppBridge.getAllAppManifests()) {
|
| + result.add(new ServiceWorkerPaymentApp(manifest));
|
| + }
|
| + return result;
|
| + }
|
| }
|
|
|