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

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

Issue 2645813006: Download web payment manifests. (Closed)
Patch Set: At most INT_MAX sections in manifest and fingperints in section Created 3 years, 10 months 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 58d95b38c5a4961275e5f471aff7aaa9393b32c1..81dfcbfaff1d1835a2293b113991bc178b54ad8b 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
@@ -397,8 +397,8 @@ public class PaymentRequestImpl
if (!parseAndValidateDetailsOrDisconnectFromClient(details)) return;
- PaymentAppFactory.getInstance().create(
- mWebContents, Collections.unmodifiableSet(mMethodData.keySet()), this);
+ PaymentAppFactory.getInstance().create(mWebContents,
+ Collections.unmodifiableSet(mMethodData.keySet()), this /* callback */);
mRequestShipping = options != null && options.requestShipping;
mRequestPayerName = options != null && options.requestPayerName;
@@ -625,6 +625,15 @@ public class PaymentRequestImpl
}
}
+ if (queryApps.isEmpty()) {
+ CanMakePaymentQuery query = sCanMakePaymentQueries.get(mSchemelessOriginForPaymentApp);
+ if (query != null && query.matchesPaymentMethods(mMethodData)) {
+ query.notifyObserversOfResponse(false);
+ }
+ }
+
+ if (disconnectIfNoPaymentMethodsSupported()) return;
+
// Query instruments after mMerchantSupportsAutofillPaymentInstruments has been initialized,
// so a fast response from a non-autofill payment app at the front of the app list does not
// cause NOT_SUPPORTED payment rejection.
@@ -1376,7 +1385,9 @@ public class PaymentRequestImpl
}
CanMakePaymentQuery query = sCanMakePaymentQueries.get(mSchemelessOriginForPaymentApp);
- if (query != null) query.notifyObserversOfResponse(mCanMakePayment);
+ if (query != null && query.matchesPaymentMethods(mMethodData)) {
+ query.notifyObserversOfResponse(mCanMakePayment);
+ }
// The list of payment instruments is ready to display.
List<PaymentInstrument> sortedInstruments = new ArrayList<>();
@@ -1402,15 +1413,14 @@ public class PaymentRequestImpl
* @return True if no payment methods are supported
*/
private boolean disconnectIfNoPaymentMethodsSupported() {
- if (!isFinishedQueryingPaymentApps()) return false;
+ if (!isFinishedQueryingPaymentApps() || !mIsCurrentPaymentRequestShowing) return false;
boolean foundPaymentMethods = mPaymentMethodsSection != null
&& !mPaymentMethodsSection.isEmpty();
boolean userCanAddCreditCard = mMerchantSupportsAutofillPaymentInstruments
&& !ChromeFeatureList.isEnabled(ChromeFeatureList.NO_CREDIT_CARD_ABORT);
- if (!mArePaymentMethodsSupported || (mIsCurrentPaymentRequestShowing && !foundPaymentMethods
- && !userCanAddCreditCard)) {
+ if (!mArePaymentMethodsSupported || (!foundPaymentMethods && !userCanAddCreditCard)) {
// All payment apps have responded, but none of them have instruments. It's possible to
// add credit cards, but the merchant does not support them either. The payment request
// must be rejected.

Powered by Google App Engine
This is Rietveld 408576698