| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java
|
| index 8d44cc4799c38283c513ad2fca5da5397e88afa5..c3aaeaf0b1548c6b345a504a1de3e551f9c482ef 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java
|
| @@ -4,6 +4,7 @@
|
|
|
| package org.chromium.chrome.browser.payments;
|
|
|
| +import android.content.Context;
|
| import android.os.Handler;
|
| import android.text.TextUtils;
|
|
|
| @@ -17,25 +18,30 @@ import org.json.JSONObject;
|
| import java.util.ArrayList;
|
| import java.util.HashSet;
|
| import java.util.List;
|
| +import java.util.Map;
|
| import java.util.Set;
|
|
|
| /**
|
| * Provides access to locally stored user credit cards.
|
| */
|
| public class AutofillPaymentApp implements PaymentApp {
|
| + private final Context mContext;
|
| private final WebContents mWebContents;
|
|
|
| /**
|
| * Builds a payment app backed by autofill cards.
|
| *
|
| + * @param context The context.
|
| * @param webContents The web contents where PaymentRequest was invoked.
|
| */
|
| - public AutofillPaymentApp(WebContents webContents) {
|
| + public AutofillPaymentApp(Context context, WebContents webContents) {
|
| + mContext = context;
|
| mWebContents = webContents;
|
| }
|
|
|
| @Override
|
| - public void getInstruments(JSONObject unusedDetails, final InstrumentsCallback callback) {
|
| + public void getInstruments(
|
| + Map<String, JSONObject> unusedMethodData, final InstrumentsCallback callback) {
|
| PersonalDataManager pdm = PersonalDataManager.getInstance();
|
| List<CreditCard> cards = pdm.getCreditCardsToSuggest();
|
| final List<PaymentInstrument> instruments = new ArrayList<>(cards.size());
|
| @@ -44,7 +50,8 @@ public class AutofillPaymentApp implements PaymentApp {
|
| CreditCard card = cards.get(i);
|
| AutofillProfile billingAddress = TextUtils.isEmpty(card.getBillingAddressId())
|
| ? null : pdm.getProfile(card.getBillingAddressId());
|
| - instruments.add(new AutofillPaymentInstrument(mWebContents, card, billingAddress));
|
| + instruments.add(
|
| + new AutofillPaymentInstrument(mContext, mWebContents, card, billingAddress));
|
| }
|
|
|
| new Handler().post(new Runnable() {
|
| @@ -56,7 +63,7 @@ public class AutofillPaymentApp implements PaymentApp {
|
| }
|
|
|
| @Override
|
| - public Set<String> getSupportedMethodNames() {
|
| + public Set<String> getAppMethodNames() {
|
| // https://w3c.github.io/webpayments-methods-card/#method-id
|
| // The spec also includes more detailed card types, e.g., "visa/credit" and "visa/debit".
|
| // Autofill does not distinguish between these types of cards, so they are not in the list
|
| @@ -79,7 +86,7 @@ public class AutofillPaymentApp implements PaymentApp {
|
| }
|
|
|
| @Override
|
| - public String getIdentifier() {
|
| + public String getAppIdentifier() {
|
| return "Chrome_Autofill_Payment_App";
|
| }
|
| }
|
|
|