Commit 4c5190ac authored by rouslan's avatar rouslan Committed by Commit bot

Hide PaymentRequest UI spinner during CVC unmask

BUG=627668

Review-Url: https://codereview.chromium.org/2140413002
Cr-Commit-Position: refs/heads/master@{#405209}
parent 33755c42
......@@ -692,13 +692,14 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
}
@Override
public void onPayClicked(PaymentOption selectedShippingAddress,
public boolean onPayClicked(PaymentOption selectedShippingAddress,
PaymentOption selectedShippingOption, PaymentOption selectedPaymentMethod) {
assert selectedPaymentMethod instanceof PaymentInstrument;
PaymentInstrument instrument = (PaymentInstrument) selectedPaymentMethod;
mPaymentAppRunning = true;
instrument.getDetails(mMerchantName, mOrigin, mRawTotal, mRawLineItems,
mMethodData.get(instrument.getMethodName()), this);
return !(instrument instanceof AutofillPaymentInstrument);
}
@Override
......@@ -816,6 +817,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
}
}
mUI.showProcessingMessage();
mClient.onPaymentResponse(response);
}
......
......@@ -137,10 +137,10 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
@DataType int optionType, Callback<PaymentInformation> checkedCallback);
/**
* Called when the user clicks on the “Pay” button. At this point, the UI is disabled and is
* showing a spinner.
* Called when the user clicks on the “Pay” button. If this method returns true, the UI is
* disabled and is showing a spinner. Otherwise, the UI is hidden.
*/
void onPayClicked(PaymentOption selectedShippingAddress,
boolean onPayClicked(PaymentOption selectedShippingAddress,
PaymentOption selectedShippingOption, PaymentOption selectedPaymentMethod);
/**
......@@ -688,12 +688,24 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
mRequestView.requestLayout();
mClient.onPayClicked(
boolean showSpinner = mClient.onPayClicked(
mShippingAddressSectionInformation == null
? null : mShippingAddressSectionInformation.getSelectedItem(),
mShippingOptionsSectionInformation == null
? null : mShippingOptionsSectionInformation.getSelectedItem(),
mPaymentMethodSectionInformation.getSelectedItem());
if (!showSpinner) mDialog.hide();
}
/**
* Called when the user has sent the payment information to the website, which is now processing
* the payment.
*/
public void showProcessingMessage() {
assert mIsProcessingPayClicked;
mIsProcessingPayClicked = false;
mDialog.show();
}
private void updatePayButtonEnabled() {
......
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