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

[WebLayer] Refactors buildUi()

In an effort to move the following showAppSelector logic into PRService:
- mJourneyLogger.setNotShown(NotShownReason.OTHER);
- disconnectFromClientWithDebugMessage(error);
- mObserverForTest.onPaymentRequestServiceShowFailed();
this CL moves this logic out of buildUi() for the convenience of
further moving.

Bug: 1148902

Change-Id: Iaea07a8d2c71cd3523b59401ce3faf44d517fc80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537114
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827839}
parent 94375950
...@@ -209,23 +209,6 @@ public class ChromePaymentRequestService ...@@ -209,23 +209,6 @@ public class ChromePaymentRequestService
} }
} }
/** @return Whether the UI was built. */
private boolean buildUI(ChromeActivity activity, boolean isShowWaitingForUpdatedDetails) {
String error = mPaymentUiService.buildPaymentRequestUI(activity,
/*isWebContentsActive=*/
PaymentRequestServiceUtil.isWebContentsActive(mRenderFrameHost),
/*isShowWaitingForUpdatedDetails=*/isShowWaitingForUpdatedDetails);
if (error != null) {
mJourneyLogger.setNotShown(NotShownReason.OTHER);
disconnectFromClientWithDebugMessage(error);
if (PaymentRequestService.getObserverForTest() != null) {
PaymentRequestService.getObserverForTest().onPaymentRequestServiceShowFailed();
}
return false;
}
return true;
}
@Override @Override
public boolean isShowingUi() { public boolean isShowingUi() {
return mPaymentUiService.isShowingUI(); return mPaymentUiService.isShowingUI();
...@@ -248,8 +231,17 @@ public class ChromePaymentRequestService ...@@ -248,8 +231,17 @@ public class ChromePaymentRequestService
mPaymentRequestService.isUserGestureShow(), mDelegate.skipUiForBasicCard(), mPaymentRequestService.isUserGestureShow(), mDelegate.skipUiForBasicCard(),
mSpec.getPaymentOptions(), mSpec.getMethodData().keySet()); mSpec.getPaymentOptions(), mSpec.getMethodData().keySet());
ChromeActivity chromeActivity = ChromeActivity.fromWebContents(mWebContents); ChromeActivity chromeActivity = ChromeActivity.fromWebContents(mWebContents);
if (quitShowIfActivityNotFound(chromeActivity) if (quitShowIfActivityNotFound(chromeActivity)) return false;
|| !buildUI(chromeActivity, isShowWaitingForUpdatedDetails)) { String error = mPaymentUiService.buildPaymentRequestUI(chromeActivity,
/*isWebContentsActive=*/
PaymentRequestServiceUtil.isWebContentsActive(mRenderFrameHost),
/*isShowWaitingForUpdatedDetails=*/isShowWaitingForUpdatedDetails);
if (error != null) {
mJourneyLogger.setNotShown(NotShownReason.OTHER);
disconnectFromClientWithDebugMessage(error);
if (PaymentRequestService.getObserverForTest() != null) {
PaymentRequestService.getObserverForTest().onPaymentRequestServiceShowFailed();
}
return false; return false;
} }
if (!mPaymentUiService.shouldSkipShowingPaymentRequestUi() && mSkipToGPayHelper == null) { if (!mPaymentUiService.shouldSkipShowingPaymentRequestUi() && mSkipToGPayHelper == null) {
......
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