| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
|
| index a9ecebacfe4c5b09ad0ee5ac40fef86e9731d573..859a46a7401153ce814bd6c60c33c3367f7b06c9 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
|
| @@ -290,6 +290,9 @@ public class PaymentRequestImpl
|
| private boolean mQueriedCanMakePayment;
|
| private CurrencyFormatter mCurrencyFormatter;
|
|
|
| + /** Aborts should only be recorded if the Payment Request was shown to the user. */
|
| + private boolean mShouldRecordAbortReason;
|
| +
|
| /** True if any of the requested payment methods are supported. */
|
| private boolean mArePaymentMethodsSupported;
|
|
|
| @@ -523,8 +526,7 @@ public class PaymentRequestImpl
|
| mContext.getCurrentTabModel().addObserver(mTabModelObserver);
|
|
|
| if (!mShouldSkipShowingPaymentRequestUi) mUI.show();
|
| - recordSuccessFunnelHistograms("Shown");
|
| - mJourneyLogger.setShowCalled();
|
| +
|
| triggerPaymentAppUiSkipIfApplicable();
|
| }
|
|
|
| @@ -534,6 +536,11 @@ public class PaymentRequestImpl
|
| if (mShouldSkipShowingPaymentRequestUi && isFinishedQueryingPaymentApps()
|
| && getIsShowing()) {
|
| assert !mPaymentMethodsSection.isEmpty();
|
| +
|
| + recordSuccessFunnelHistograms("Shown");
|
| + mShouldRecordAbortReason = true;
|
| + mJourneyLogger.setShowCalled();
|
| +
|
| onPayClicked(null /* selectedShippingAddress */, null /* selectedShippingOption */,
|
| mPaymentMethodsSection.getItem(0));
|
| }
|
| @@ -807,6 +814,10 @@ public class PaymentRequestImpl
|
| new PaymentInformation(mUiShoppingCart, mShippingAddressesSection,
|
| mUiShippingOptions, mContactSection, mPaymentMethodsSection));
|
| mPaymentInformationCallback = null;
|
| +
|
| + recordSuccessFunnelHistograms("Shown");
|
| + mShouldRecordAbortReason = true;
|
| + mJourneyLogger.setShowCalled();
|
| }
|
|
|
| @Override
|
| @@ -1380,9 +1391,9 @@ public class PaymentRequestImpl
|
| // must be rejected.
|
| disconnectFromClientWithDebugMessage("Requested payment methods have no instruments",
|
| PaymentErrorReason.NOT_SUPPORTED);
|
| - recordAbortReasonHistogram(mArePaymentMethodsSupported
|
| - ? PaymentRequestMetrics.ABORT_REASON_NO_MATCHING_PAYMENT_METHOD
|
| - : PaymentRequestMetrics.ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD);
|
| + recordNoShowReasonHistogram(mArePaymentMethodsSupported
|
| + ? PaymentRequestMetrics.NO_SHOW_NO_MATCHING_PAYMENT_METHOD
|
| + : PaymentRequestMetrics.NO_SHOW_NO_SUPPORTED_PAYMENT_METHOD);
|
| if (sObserverForTest != null) sObserverForTest.onPaymentRequestServiceShowFailed();
|
| return true;
|
| }
|
| @@ -1545,7 +1556,7 @@ public class PaymentRequestImpl
|
| */
|
| private void recordAbortReasonHistogram(int abortReason) {
|
| assert abortReason < PaymentRequestMetrics.ABORT_REASON_MAX;
|
| - if (mHasRecordedAbortReason) return;
|
| + if (mHasRecordedAbortReason || !mShouldRecordAbortReason) return;
|
|
|
| mHasRecordedAbortReason = true;
|
| RecordHistogram.recordEnumeratedHistogram(
|
| @@ -1560,6 +1571,17 @@ public class PaymentRequestImpl
|
| }
|
|
|
| /**
|
| + * Adds an entry to the NoShow Payment Request histogram in the bucket corresponding to the
|
| + * reason for not showing the Payment Request.
|
| + */
|
| + private void recordNoShowReasonHistogram(int reason) {
|
| + assert reason < PaymentRequestMetrics.NO_SHOW_REASON_MAX;
|
| +
|
| + RecordHistogram.recordEnumeratedHistogram("PaymentRequest.CheckoutFunnel.NoShow", reason,
|
| + PaymentRequestMetrics.NO_SHOW_REASON_MAX);
|
| + }
|
| +
|
| + /**
|
| * Compares two payment instruments by frecency.
|
| * Return negative value if a has strictly lower frecency score than b.
|
| * Return zero if a and b have the same frecency score.
|
|
|