| Index: components/payments/content/payment_request.cc
|
| diff --git a/components/payments/content/payment_request.cc b/components/payments/content/payment_request.cc
|
| index 852d877f889932c288f0aa0fff98927d9600cc65..1363bb50a08d127c1778c7599761b7735c4ec538 100644
|
| --- a/components/payments/content/payment_request.cc
|
| +++ b/components/payments/content/payment_request.cc
|
| @@ -156,9 +156,8 @@ void PaymentRequest::Abort() {
|
| // TODO(crbug.com/716546): Add a merchant abort metric
|
|
|
| bool accepting_abort = !state_->IsPaymentAppInvoked();
|
| - if (accepting_abort) {
|
| - RecordFirstCompletionStatus(JourneyLogger::COMPLETION_STATUS_OTHER_ABORTED);
|
| - }
|
| + if (accepting_abort)
|
| + RecordFirstAbortReason(JourneyLogger::ABORT_REASON_ABORTED_BY_MERCHANT);
|
|
|
| if (client_.is_bound())
|
| client_->OnAbort(accepting_abort);
|
| @@ -174,7 +173,10 @@ void PaymentRequest::Complete(mojom::PaymentComplete result) {
|
| if (result != mojom::PaymentComplete::SUCCESS) {
|
| delegate_->ShowErrorMessage();
|
| } else {
|
| + DCHECK(!has_recorded_completion_);
|
| journey_logger_.SetCompleted();
|
| + has_recorded_completion_ = true;
|
| +
|
| delegate_->GetPrefService()->SetBoolean(kPaymentsFirstTransactionCompleted,
|
| true);
|
| // When the renderer closes the connection,
|
| @@ -234,7 +236,7 @@ void PaymentRequest::UserCancelled() {
|
| if (!client_.is_bound())
|
| return;
|
|
|
| - RecordFirstCompletionStatus(JourneyLogger::COMPLETION_STATUS_USER_ABORTED);
|
| + RecordFirstAbortReason(JourneyLogger::ABORT_REASON_ABORTED_BY_USER);
|
|
|
| // This sends an error to the renderer, which informs the API user.
|
| client_->OnError(mojom::PaymentErrorReason::USER_CANCEL);
|
| @@ -248,9 +250,9 @@ void PaymentRequest::UserCancelled() {
|
| }
|
|
|
| void PaymentRequest::DidStartNavigation(bool is_user_initiated) {
|
| - RecordFirstCompletionStatus(
|
| - is_user_initiated ? JourneyLogger::COMPLETION_STATUS_USER_ABORTED
|
| - : JourneyLogger::COMPLETION_STATUS_OTHER_ABORTED);
|
| + RecordFirstAbortReason(is_user_initiated
|
| + ? JourneyLogger::ABORT_REASON_USER_NAVIGATION
|
| + : JourneyLogger::ABORT_REASON_MERCHANT_NAVIGATION);
|
| }
|
|
|
| void PaymentRequest::OnConnectionTerminated() {
|
| @@ -264,6 +266,8 @@ void PaymentRequest::OnConnectionTerminated() {
|
| delegate_->CloseDialog();
|
| if (observer_for_testing_)
|
| observer_for_testing_->OnConnectionTerminated();
|
| +
|
| + RecordFirstAbortReason(JourneyLogger::ABORT_REASON_MOJO_CONNECTION_ERROR);
|
| manager_->DestroyRequest(this);
|
| }
|
|
|
| @@ -271,16 +275,11 @@ void PaymentRequest::Pay() {
|
| state_->GeneratePaymentResponse();
|
| }
|
|
|
| -void PaymentRequest::RecordFirstCompletionStatus(
|
| - JourneyLogger::CompletionStatus completion_status) {
|
| - if (!has_recorded_abort_reason_) {
|
| - has_recorded_abort_reason_ = true;
|
| - // TODO(crbug.com/716546): Record more abort reasons.
|
| - if (completion_status == JourneyLogger::COMPLETION_STATUS_USER_ABORTED) {
|
| - journey_logger_.SetAborted(JourneyLogger::ABORT_REASON_ABORTED_BY_USER);
|
| - } else {
|
| - journey_logger_.SetAborted(JourneyLogger::ABORT_REASON_OTHER);
|
| - }
|
| +void PaymentRequest::RecordFirstAbortReason(
|
| + JourneyLogger::AbortReason abort_reason) {
|
| + if (!has_recorded_completion_) {
|
| + has_recorded_completion_ = true;
|
| + journey_logger_.SetAborted(abort_reason);
|
| }
|
| }
|
|
|
|
|