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

[WebLayer] Refactored retry()

This CL splits CPRService#retry() into two parts. The common part goes
into PRService, while the Chrome specific part is left in CPRService.

Bug: 1131059

Change-Id: I9a90c53f109c7f5224129904f3af22f92bcadf4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536854
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827554}
parent 01866af0
...@@ -39,7 +39,6 @@ import org.chromium.components.payments.PaymentRequestServiceUtil; ...@@ -39,7 +39,6 @@ import org.chromium.components.payments.PaymentRequestServiceUtil;
import org.chromium.components.payments.PaymentRequestSpec; import org.chromium.components.payments.PaymentRequestSpec;
import org.chromium.components.payments.PaymentResponseHelperInterface; import org.chromium.components.payments.PaymentResponseHelperInterface;
import org.chromium.components.payments.PaymentUIsObserver; import org.chromium.components.payments.PaymentUIsObserver;
import org.chromium.components.payments.PaymentValidator;
import org.chromium.components.payments.Section; import org.chromium.components.payments.Section;
import org.chromium.components.payments.SkipToGPayHelper; import org.chromium.components.payments.SkipToGPayHelper;
import org.chromium.content_public.browser.RenderFrameHost; import org.chromium.content_public.browser.RenderFrameHost;
...@@ -647,19 +646,7 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest, ...@@ -647,19 +646,7 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest,
// Implement BrowserPaymentRequest: // Implement BrowserPaymentRequest:
@Override @Override
public void retry(PaymentValidationErrors errors) { public void retry(PaymentValidationErrors errors) {
if (mPaymentRequestService == null) return;
// mSpec.retry() can be used only when mSpec has not been destroyed.
assert !mSpec.isDestroyed();
if (!PaymentValidator.validatePaymentValidationErrors(errors)) {
mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER);
disconnectFromClientWithDebugMessage(ErrorStrings.INVALID_VALIDATION_ERRORS);
return;
}
mSpec.retry(errors);
mWasRetryCalled = true; mWasRetryCalled = true;
mPaymentUiService.onRetry(errors); mPaymentUiService.onRetry(errors);
} }
......
...@@ -1085,6 +1085,15 @@ public class PaymentRequestService ...@@ -1085,6 +1085,15 @@ public class PaymentRequestService
*/ */
/* package */ void retry(PaymentValidationErrors errors) { /* package */ void retry(PaymentValidationErrors errors) {
if (mBrowserPaymentRequest == null) return; if (mBrowserPaymentRequest == null) return;
if (!PaymentValidator.validatePaymentValidationErrors(errors)) {
mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER);
disconnectFromClientWithDebugMessage(
ErrorStrings.INVALID_VALIDATION_ERRORS, PaymentErrorReason.USER_CANCEL);
return;
}
assert mSpec != null;
assert !mSpec.isDestroyed() : "mSpec should not be used after being destroyed.";
mSpec.retry(errors);
mBrowserPaymentRequest.retry(errors); mBrowserPaymentRequest.retry(errors);
} }
......
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