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

[WebLayer] Clean up unused methods, limit access modifiers

Changes:
* Simplified onCompleteHandled::run to be onCompleteHandled
* Removed CPRService.mRequestShipping
* Limited the access modifiers
 - MinimalUiCoordinator#showCompleteAndClose
 - PUiService#onPaymentRequestUiClosed, #onBottomSheetShown
 - WebPaymentIntentHelperTypeConverter
 - remove PRService#resetWaitingForUpdatedDetails, setUserGestureShow,
   setCurrentPaymentRequestShowing, getHasNonAutofillApp
 - corrected @link PaymentResponseRequesterDelegate
 - inlined PRService#onError

Change-Id: Id1af3182bb887fde6142967638adbf99022cd891
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536984
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827617}
parent ffa1e45e
......@@ -81,7 +81,6 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest,
private final PaymentUiService mPaymentUiService;
private final PaymentOptions mPaymentOptions;
private final boolean mRequestShipping;
private boolean mWasRetryCalled;
private boolean mHasClosed;
......@@ -136,7 +135,6 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest,
mPaymentOptions = paymentRequestService.getPaymentOptions();
assert mPaymentOptions != null;
mRequestShipping = mPaymentOptions.requestShipping;
mPaymentRequestService = paymentRequestService;
mPaymentUiService = new PaymentUiService(/*delegate=*/this,
......@@ -640,7 +638,7 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest,
}
mPaymentUiService.onPaymentRequestComplete(result,
/*onMinimalUiErroredAndClosed=*/this::close, onCompleteHandled::run);
/*onMinimalUiErroredAndClosed=*/this::close, onCompleteHandled);
}
// Implement BrowserPaymentRequest:
......
......@@ -76,7 +76,7 @@ public class MinimalUICoordinator {
/**
* Shows the minimal UI.
*
* @param chromeActivity The activity where the UI should be shown.
* @param context The context where the UI should be shown.
* @param app The app that contains the details to display and can be invoked
* upon user confirmation.
* @param formatter Formats the account balance amount according to its currency.
......@@ -137,7 +137,7 @@ public class MinimalUICoordinator {
* has closed.
* @param observer The observer to notify when the UI has closed.
*/
public void showCompleteAndClose(CompleteAndCloseObserver observer) {
private void showCompleteAndClose(CompleteAndCloseObserver observer) {
mMediator.showCompleteAndClose(observer);
}
......
......@@ -224,7 +224,7 @@ public class PaymentUiService implements SettingsAutofillAndPaymentsObserver.Obs
}
/** A callback invoked when the Payment Request UI is closed. */
public void onPaymentRequestUiClosed() {
private void onPaymentRequestUiClosed() {
assert mPaymentRequestUI == null;
mShouldShowDialog = false;
}
......@@ -1215,7 +1215,7 @@ public class PaymentUiService implements SettingsAutofillAndPaymentsObserver.Obs
mJourneyLogger.setNumberOfSuggestionsShown(
Section.SHIPPING_ADDRESS, addresses.size(), hasCompleteShippingAddress);
int missingFields = 0;
int missingFields;
if (addresses.isEmpty()) {
// All fields are missing.
missingFields = AutofillAddress.CompletionStatus.INVALID_RECIPIENT
......
......@@ -368,14 +368,6 @@ public class PaymentRequestService
return mIsShowWaitingForUpdatedDetails;
}
/**
* Sets that the payment details is no longer pending to be updated because the promise that
* was passed into PaymentRequest.show() has been resolved.
*/
public void resetWaitingForUpdatedDetails() {
mIsShowWaitingForUpdatedDetails = false;
}
/**
* Called to open a new PaymentHandler UI on the showing PaymentRequest.
* @param url The url of the payment app to be displayed in the UI.
......@@ -557,7 +549,7 @@ public class PaymentRequestService
* @param paymentApp The payment app to be invoked.
* @param paymentResponseHelper The helper to create and fill the response to send to the
* merchant. The helper should have this instance as the delegate {@link
* PaymentResponseHelperInterface.PaymentResponseRequesterDelegate}.
* PaymentResponseHelperInterface.PaymentResponseResultCallback}.
*/
public void invokePaymentApp(
PaymentApp paymentApp, PaymentResponseHelperInterface paymentResponseHelper) {
......@@ -726,27 +718,11 @@ public class PaymentRequestService
return mIsUserGestureShow;
}
/**
* Records that PaymentRequest.show() was invoked with a user gesture.
* @param userGestureShow Whether it is invoked with a user gesture.
*/
public void setUserGestureShow(boolean userGestureShow) {
mIsUserGestureShow = userGestureShow;
}
/** @return Whether the current payment request service has called show(). */
public boolean isCurrentPaymentRequestShowing() {
return mIsCurrentPaymentRequestShowing;
}
/**
* Records whether the current payment request service has called show().
* @param isShowing Whether show() has been called.
*/
public void setCurrentPaymentRequestShowing(boolean isShowing) {
mIsCurrentPaymentRequestShowing = isShowing;
}
/**
* @return Whether all payment apps have been queried of canMakePayment() and
* hasEnrolledInstrument().
......@@ -866,11 +842,6 @@ public class PaymentRequestService
}
}
/** @return Whether the created payment apps includes any autofill payment app. */
public boolean getHasNonAutofillApp() {
return mHasNonAutofillApp;
}
/**
* @param methodDataList A list of PaymentMethodData.
* @return The validated method data, a mapping of method names to its PaymentMethodData(s);
......@@ -1225,11 +1196,6 @@ public class PaymentRequestService
if (mClient != null) mClient.onPayerDetailChange(detail);
}
/** Invokes {@link PaymentRequestClient.onError}. */
public void onError(int error, String errorMessage) {
if (mClient != null) mClient.onError(error, errorMessage);
}
/** Invokes {@link PaymentRequestClient.warnNoFavicon}. */
public void warnNoFavicon() {
if (mClient != null) mClient.warnNoFavicon();
......
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