Commit aa7d1d0a authored by Liquan (Max) Gu's avatar Liquan (Max) Gu Committed by Chromium LUCI CQ

[WebLayer] Move disconnectIfNoPaymentMethodsSupported

Motivation:
This CL lays the preparatory work to create onShowCalledAndAppQueried()
which will encapsulate the following methods:
- disconnectIfNoPaymentMethodsSupported
- showAppSelector
- triggerPaymentAppUiSkipIfApplicable

Behavioural changes:
Note that disconnectIfNoPaymentMethodsSupported() depends on
mHasEnrolledInstrument, so this moving will add prefsCanMakePayment
to the disconnection conditions. The new behaviour should be a
correct one because mHasEnrolledInstrument is finalized only after
prefsCanMakePayment. Before the CL,
disconnectIfNoPaymentMethodsSupported tests different
mHasEnrolledInstrument when it's invoked in different places.

Bug: 1153353
Change-Id: I6752d33d5c4d2bbbb6ce237248dc4692584ef1e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2562836
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832185}
parent c0b6fe3f
...@@ -743,18 +743,10 @@ public class PaymentRequestService ...@@ -743,18 +743,10 @@ public class PaymentRequestService
mIsFinishedQueryingPaymentApps = true; mIsFinishedQueryingPaymentApps = true;
if (mIsShowCalled && disconnectIfNoPaymentMethodsSupported()) return;
// Always return false when can make payment is disabled. // Always return false when can make payment is disabled.
mHasEnrolledInstrument &= mDelegate.prefsCanMakePayment(); mHasEnrolledInstrument &= mDelegate.prefsCanMakePayment();
if (mIsCanMakePaymentResponsePending) { if (mIsShowCalled && disconnectIfNoPaymentMethodsSupported()) return;
respondCanMakePaymentQuery();
}
if (mIsHasEnrolledInstrumentResponsePending) {
respondHasEnrolledInstrumentQuery();
}
mBrowserPaymentRequest.notifyPaymentUiOfPendingApps(mPendingApps); mBrowserPaymentRequest.notifyPaymentUiOfPendingApps(mPendingApps);
mPendingApps.clear(); mPendingApps.clear();
...@@ -772,6 +764,14 @@ public class PaymentRequestService ...@@ -772,6 +764,14 @@ public class PaymentRequestService
onShowFailed(error); onShowFailed(error);
return; return;
} }
if (mIsCanMakePaymentResponsePending) {
respondCanMakePaymentQuery();
}
if (mIsHasEnrolledInstrumentResponsePending) {
respondHasEnrolledInstrumentQuery();
}
} }
private void onShowFailed(String error) { private void onShowFailed(String error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment