Commit d73a93af authored by Liquan (Max) Gu's avatar Liquan (Max) Gu Committed by Commit Bot

[PRImpl] Simplifies non-minimal UI complete() flow

Change:
* For close() and closeUIAndDestroyNativeObjects() called together,
remove closeUIAndDestroyNativeObjects() because close() already has it.
* Move PR UI (non-minimal UI)'s complete handling (#onComplete in
particular) out of closeUIAndDestroyNativeObjects(), because
#onComplete is supposed to be called only in response to PR#complete().

Bug: 1102522

Change-Id: I68c1e7027219790f105fe5c46deee2168a2a674a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404397
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806638}
parent 1531f644
......@@ -571,25 +571,26 @@ public class PaymentRequestImpl
}
private void onMinimalUiErroredAndClosed() {
if (mComponentPaymentRequestImpl == null) return;
close();
closeUIAndDestroyNativeObjects();
}
private void onMinimalUiCompletedAndClosed() {
if (mComponentPaymentRequestImpl != null) {
if (mComponentPaymentRequestImpl == null) return;
mComponentPaymentRequestImpl.onComplete();
}
close();
closeUIAndDestroyNativeObjects();
}
private void onPaymentRequestCompleteForNonMinimalUI() {
if (ComponentPaymentRequestImpl.getNativeObserverForTest() != null) {
ComponentPaymentRequestImpl.getNativeObserverForTest().onCompleteCalled();
}
closeUIAndDestroyNativeObjects();
if (ComponentPaymentRequestImpl.getObserverForTest() != null) {
ComponentPaymentRequestImpl.getObserverForTest().onCompleteReplied();
}
if (mComponentPaymentRequestImpl != null) {
mComponentPaymentRequestImpl.onComplete();
close();
}
}
private static Map<String, PaymentMethodData> getValidatedMethodData(
......@@ -1162,7 +1163,6 @@ public class PaymentRequestImpl
mComponentPaymentRequestImpl.onError(reason, debugMessage);
}
close();
closeUIAndDestroyNativeObjects();
if (ComponentPaymentRequestImpl.getNativeObserverForTest() != null) {
ComponentPaymentRequestImpl.getNativeObserverForTest().onConnectionTerminated();
}
......@@ -1800,13 +1800,6 @@ public class PaymentRequestImpl
if (mPaymentUIsManager.getPaymentRequestUI() != null) {
mPaymentUIsManager.getPaymentRequestUI().close();
if (mComponentPaymentRequestImpl != null) {
if (ComponentPaymentRequestImpl.getObserverForTest() != null) {
ComponentPaymentRequestImpl.getObserverForTest().onCompleteReplied();
}
mComponentPaymentRequestImpl.onComplete();
close();
}
ChromeActivity activity = ChromeActivity.fromWebContents(mWebContents);
if (activity != null) {
activity.getLifecycleDispatcher().unregister(
......
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