Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| index 15e0acb6c1721e815f6d451db8fbd9aff28c53ea..523d0587e36946830bdf7baa921e00d9263d75f7 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| @@ -621,11 +621,11 @@ public class PaymentRequestImpl |
| mUiShippingOptions = getShippingOptions(details.shippingOptions, mCurrencyFormatter); |
| + mModifiers = new ArrayMap<>(); |
| for (int i = 0; i < details.modifiers.length; i++) { |
| PaymentDetailsModifier modifier = details.modifiers[i]; |
| String[] methods = modifier.methodData.supportedMethods; |
| for (int j = 0; j < methods.length; j++) { |
| - if (mModifiers == null) mModifiers = new ArrayMap<>(); |
|
please use gerrit instead
2017/01/19 16:45:04
I would prefer to keep null ArrayMap if the mercha
tommyt
2017/01/20 09:33:29
Done.
|
| mModifiers.put(methods[j], modifier); |
| } |
| } |
| @@ -1034,19 +1034,25 @@ public class PaymentRequestImpl |
| mPaymentResponseHelper = new PaymentResponseHelper( |
| selectedShippingAddress, selectedShippingOption, selectedContact, this); |
| - // Create a map that is the subset of mMethodData that contains the |
| - // payment methods supported by the selected payment instrument. If this |
| - // intersection contains more than one payment method, the payment app is |
| - // at liberty to choose (or have the user choose) one of the methods. |
| + // Create maps that are subsets of mMethodData and mModifiers, that contain |
| + // the payment methods supported by the selected payment instrument. If the |
| + // intersection of method data contains more than one payment method, the |
| + // payment app is at liberty to choose (or have the user choose) one of the |
| + // methods. |
| Map<String, PaymentMethodData> methodData = new HashMap<>(); |
| + Map<String, PaymentDetailsModifier> modifiers = new HashMap<>(); |
| for (String instrumentMethodName : instrument.getInstrumentMethodNames()) { |
| if (mMethodData.containsKey(instrumentMethodName)) { |
| methodData.put(instrumentMethodName, mMethodData.get(instrumentMethodName)); |
| } |
| + if (mModifiers.containsKey(instrumentMethodName)) { |
|
please use gerrit instead
2017/01/19 16:45:04
You can check mModifiers != null here, if you keep
tommyt
2017/01/20 09:33:29
Done.
|
| + modifiers.put(instrumentMethodName, mModifiers.get(instrumentMethodName)); |
| + } |
| } |
| - instrument.invokePaymentApp(mMerchantName, mOrigin, mRawTotal, mRawLineItems, |
| - Collections.unmodifiableMap(methodData), this); |
| + instrument.invokePaymentApp(mMerchantName, mOrigin, Collections.unmodifiableMap(methodData), |
| + mRawTotal, mRawLineItems, Collections.unmodifiableMap(modifiers), this); |
|
please use gerrit instead
2017/01/19 16:45:04
Might be a good idea to make mRawLineItems unmodif
tommyt
2017/01/20 09:33:29
It should already be unmodifiable. It is assigned
|
| + |
| recordSuccessFunnelHistograms("PayClicked"); |
| return !(instrument instanceof AutofillPaymentInstrument); |
| } |