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

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

Issue 2511953004: Consider payment method specific data when filtering payment apps. (Closed)
Patch Set: Don't pass null into Collections.unmodifiable() Created 4 years, 1 month 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
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 8d27c545b41b2805a6f58d130ed74abd7ec5045f..8025813abc8da8cb5dcd593fe698372a65f5ac54 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
@@ -494,7 +494,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
paymentMethodsCollector.addAcceptedPaymentMethodsIfRecognized(methods);
}
- return result;
+ return Collections.unmodifiableMap(result);
}
/** Queries the installed payment apps for their instruments that merchant supports. */
@@ -508,7 +508,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
PaymentApp app = mApps.get(i);
Map<String, PaymentMethodData> appMethods =
filterMerchantMethodData(mMethodData, app.getAppMethodNames());
- if (appMethods == null) {
+ if (appMethods == null || !app.supportsMethodsAndData(appMethods)) {
mPendingApps.remove(app);
} else {
mArePaymentMethodsSupported = true;
@@ -535,7 +535,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
result.put(method, merchantMethodData.get(method));
}
}
- return result;
+ return result == null ? null : Collections.unmodifiableMap(result);
}
/**
@@ -599,7 +599,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
mUiShoppingCart = new ShoppingCart(uiTotal, uiLineItems);
mRawTotal = details.total;
- mRawLineItems = Arrays.asList(details.displayItems);
+ mRawLineItems = Collections.unmodifiableList(Arrays.asList(details.displayItems));
mUiShippingOptions = getShippingOptions(details.shippingOptions, totalCurrency, formatter);
@@ -640,7 +640,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
item.label, "", formatter.format(item.amount.value), item.pending));
}
- return result;
+ return Collections.unmodifiableList(result);
}
/**
@@ -668,7 +668,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
}
return new SectionInformation(PaymentRequestUI.TYPE_SHIPPING_OPTIONS, selectedItemIndex,
- result);
+ Collections.unmodifiableList(result));
}
/**

Powered by Google App Engine
This is Rietveld 408576698