| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
| 6 | 6 |
| 7 import android.content.Context; |
| 8 |
| 7 import org.chromium.base.VisibleForTesting; | 9 import org.chromium.base.VisibleForTesting; |
| 8 import org.chromium.content_public.browser.WebContents; | 10 import org.chromium.content_public.browser.WebContents; |
| 9 | 11 |
| 10 import java.util.ArrayList; | 12 import java.util.ArrayList; |
| 11 import java.util.List; | 13 import java.util.List; |
| 12 | 14 |
| 13 /** | 15 /** |
| 14 * Builds instances of payment apps. | 16 * Builds instances of payment apps. |
| 15 */ | 17 */ |
| 16 public class PaymentAppFactory { | 18 public class PaymentAppFactory { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 38 @VisibleForTesting | 40 @VisibleForTesting |
| 39 public static void setAdditionalFactory(PaymentAppFactoryAddition additional
Factory) { | 41 public static void setAdditionalFactory(PaymentAppFactoryAddition additional
Factory) { |
| 40 sAdditionalFactory = additionalFactory; | 42 sAdditionalFactory = additionalFactory; |
| 41 } | 43 } |
| 42 | 44 |
| 43 /** | 45 /** |
| 44 * Builds instances of payment apps. | 46 * Builds instances of payment apps. |
| 45 * | 47 * |
| 46 * @param webContents The web contents where PaymentRequest was invoked. | 48 * @param webContents The web contents where PaymentRequest was invoked. |
| 47 */ | 49 */ |
| 48 public static List<PaymentApp> create(WebContents webContents) { | 50 public static List<PaymentApp> create(Context context, WebContents webConten
ts) { |
| 49 List<PaymentApp> result = new ArrayList<>(2); | 51 List<PaymentApp> result = new ArrayList<>(2); |
| 50 result.add(new AutofillPaymentApp(webContents)); | 52 result.add(new AutofillPaymentApp(context, webContents)); |
| 51 if (sAdditionalFactory != null) result.addAll(sAdditionalFactory.create(
webContents)); | 53 if (sAdditionalFactory != null) result.addAll(sAdditionalFactory.create(
webContents)); |
| 52 return result; | 54 return result; |
| 53 } | 55 } |
| 54 } | 56 } |
| OLD | NEW |