| Index: components/payments/content/payment_request.cc
|
| diff --git a/components/payments/content/payment_request.cc b/components/payments/content/payment_request.cc
|
| index 540059b5952c324f8a148dcb12b4b9c920471824..af2ca0de691768fbe2b99586a49a57a61562b69c 100644
|
| --- a/components/payments/content/payment_request.cc
|
| +++ b/components/payments/content/payment_request.cc
|
| @@ -152,8 +152,7 @@ void PaymentRequest::Abort() {
|
| // the renderer, which closes the Mojo message pipe, which triggers
|
| // PaymentRequest::OnConnectionTerminated, which destroys this object.
|
| // TODO(crbug.com/716546): Add a merchant abort metric,
|
| - journey_logger_.RecordJourneyStatsHistograms(
|
| - JourneyLogger::COMPLETION_STATUS_OTHER_ABORTED);
|
| + RecordFirstCompletionStatus(JourneyLogger::COMPLETION_STATUS_OTHER_ABORTED);
|
| if (client_.is_bound())
|
| client_->OnAbort(true /* aborted_successfully */);
|
| }
|
| @@ -226,8 +225,7 @@ void PaymentRequest::UserCancelled() {
|
| if (!client_.is_bound())
|
| return;
|
|
|
| - journey_logger_.RecordJourneyStatsHistograms(
|
| - JourneyLogger::COMPLETION_STATUS_USER_ABORTED);
|
| + RecordFirstCompletionStatus(JourneyLogger::COMPLETION_STATUS_USER_ABORTED);
|
|
|
| // This sends an error to the renderer, which informs the API user.
|
| client_->OnError(mojom::PaymentErrorReason::USER_CANCEL);
|
| @@ -240,6 +238,12 @@ void PaymentRequest::UserCancelled() {
|
| manager_->DestroyRequest(this);
|
| }
|
|
|
| +void PaymentRequest::DidStartNavigation(bool is_user_initiated) {
|
| + RecordFirstCompletionStatus(
|
| + is_user_initiated ? JourneyLogger::COMPLETION_STATUS_USER_ABORTED
|
| + : JourneyLogger::COMPLETION_STATUS_OTHER_ABORTED);
|
| +}
|
| +
|
| void PaymentRequest::OnConnectionTerminated() {
|
| // We are here because of a browser-side error, or likely as a result of the
|
| // connection_error_handler on |binding_|, which can mean that the renderer
|
| @@ -258,4 +262,12 @@ void PaymentRequest::Pay() {
|
| state_->GeneratePaymentResponse();
|
| }
|
|
|
| +void PaymentRequest::RecordFirstCompletionStatus(
|
| + JourneyLogger::CompletionStatus completion_status) {
|
| + if (!has_recorded_abort_reason_) {
|
| + has_recorded_abort_reason_ = true;
|
| + journey_logger_.RecordJourneyStatsHistograms(completion_status);
|
| + }
|
| +}
|
| +
|
| } // namespace payments
|
|
|