| 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 2d18e5fdbc35f5e8b70652a5d7e164e2d1af8fb8..e5073c7bcaf35ec802d87ee175168ecba9cf29d8 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
|
| @@ -297,6 +297,9 @@ public class PaymentRequestImpl
|
| private TabModelSelector mObservedTabModelSelector;
|
| private TabModel mObservedTabModel;
|
|
|
| + /** 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;
|
|
|
| @@ -532,8 +535,7 @@ public class PaymentRequestImpl
|
|
|
| buildUI(chromeActivity);
|
| if (!mShouldSkipShowingPaymentRequestUi) mUI.show();
|
| - recordSuccessFunnelHistograms("Shown");
|
| - mJourneyLogger.setShowCalled();
|
| +
|
| triggerPaymentAppUiSkipIfApplicable();
|
| }
|
|
|
| @@ -543,6 +545,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));
|
| }
|
| @@ -816,6 +823,10 @@ public class PaymentRequestImpl
|
| new PaymentInformation(mUiShoppingCart, mShippingAddressesSection,
|
| mUiShippingOptions, mContactSection, mPaymentMethodsSection));
|
| mPaymentInformationCallback = null;
|
| +
|
| + recordSuccessFunnelHistograms("Shown");
|
| + mShouldRecordAbortReason = true;
|
| + mJourneyLogger.setShowCalled();
|
| }
|
|
|
| @Override
|
| @@ -1396,9 +1407,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;
|
| }
|
| @@ -1568,7 +1579,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(
|
| @@ -1583,6 +1594,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.
|
|
|