Chromium Code Reviews| Index: components/payments/content/payment_request.cc |
| diff --git a/components/payments/content/payment_request.cc b/components/payments/content/payment_request.cc |
| index 69a13a702eb5ee0749eedbd3a8a0fdc4cb1bedee..2b87f37eea6f325ac3303188eca479464fdab8ca 100644 |
| --- a/components/payments/content/payment_request.cc |
| +++ b/components/payments/content/payment_request.cc |
| @@ -150,8 +150,11 @@ 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); |
| + if (!has_recorded_abort_reason_) { |
|
Mathieu
2017/05/10 20:23:07
as discussed let's move this to a private method
|
| + has_recorded_abort_reason_ = true; |
| + journey_logger_.RecordJourneyStatsHistograms( |
| + JourneyLogger::COMPLETION_STATUS_OTHER_ABORTED); |
| + } |
| if (client_.is_bound()) |
| client_->OnAbort(true /* aborted_successfully */); |
| } |
| @@ -221,8 +224,11 @@ void PaymentRequest::UserCancelled() { |
| if (!client_.is_bound()) |
| return; |
| - journey_logger_.RecordJourneyStatsHistograms( |
| - JourneyLogger::COMPLETION_STATUS_USER_ABORTED); |
| + if (!has_recorded_abort_reason_) { |
| + has_recorded_abort_reason_ = true; |
| + journey_logger_.RecordJourneyStatsHistograms( |
| + JourneyLogger::COMPLETION_STATUS_USER_ABORTED); |
| + } |
| // This sends an error to the renderer, which informs the API user. |
| client_->OnError(mojom::PaymentErrorReason::USER_CANCEL); |
| @@ -235,6 +241,15 @@ void PaymentRequest::UserCancelled() { |
| manager_->DestroyRequest(this); |
| } |
| +void PaymentRequest::DidStartNavigation(bool is_user_initiated) { |
| + if (!has_recorded_abort_reason_) { |
| + has_recorded_abort_reason_ = true; |
| + journey_logger_.RecordJourneyStatsHistograms( |
| + 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 |