Commit a176e8fd authored by Zarah Tesfai's avatar Zarah Tesfai Committed by Commit Bot

[PRImpl] Move getDefaultPaymentInformation to PaymentUIsManager

Since getDefaultPaymentInformation is PaymentRequest UI logic,
move it into PaymentUIsManager.

Bug: 1102522, 1114791
Change-Id: If2f958f38bd81677d734621150ad944b19945212
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2406693
Commit-Queue: Zarah Tesfai <ztesfai@google.com>
Reviewed-by: default avatarLiquan (Max) Gu <maxlg@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806685}
parent 13c126e3
......@@ -961,21 +961,8 @@ public class PaymentRequestImpl
*/
@Override
public void getDefaultPaymentInformation(Callback<PaymentInformation> callback) {
mPaymentUIsManager.setPaymentInformationCallback(callback);
// mPaymentUIsManager.getPaymentRequestUI().show() is called only after request.show() is
// called and all payment apps are ready.
assert mIsCurrentPaymentRequestShowing;
assert mIsFinishedQueryingPaymentApps;
if (mWaitForUpdatedDetails) return;
mHandler.post(() -> {
if (mPaymentUIsManager.getPaymentRequestUI() != null) {
mPaymentUIsManager.providePaymentInformationToPaymentRequestUI();
recordShowEventAndTransactionAmount();
}
});
mPaymentUIsManager.getDefaultPaymentInformation(callback, mIsCurrentPaymentRequestShowing,
mIsFinishedQueryingPaymentApps, mWaitForUpdatedDetails);
}
// Implement PaymentUIsManager.Delegate:
......
......@@ -1495,6 +1495,33 @@ public class PaymentUIsManager implements SettingsAutofillAndPaymentsObserver.Ob
}
}
/**
* The implementation of {@link PaymentRequestUI.Client#getDefaultPaymentInformation}.
* @param callback Retrieves the data to show in the initial PaymentRequest UI.
* @param isCurrentPaymentRequestShowing Whether the current payment request is showing.
* @param isFinishedQueryingPaymentApps Whether payment apps have finished being queried.
* @param waitForUpdatedDetails Whether to wait for updated payment details.
*/
public void getDefaultPaymentInformation(Callback<PaymentInformation> callback,
boolean isCurrentPaymentRequestShowing, boolean isFinishedQueryingPaymentApps,
boolean waitForUpdatedDetails) {
mPaymentInformationCallback = callback;
// mPaymentRequestUI.show() is called only after request.show() is
// called and all payment apps are ready.
assert isCurrentPaymentRequestShowing;
assert isFinishedQueryingPaymentApps;
if (waitForUpdatedDetails) return;
mHandler.post(() -> {
if (mPaymentRequestUI != null) {
providePaymentInformationToPaymentRequestUI();
mDelegate.recordShowEventAndTransactionAmount();
}
});
}
/**
* The implementation of {@link PaymentRequestUI.Client#onSectionOptionSelected}.
* @param optionType Data being updated.
......
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