Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Unified Diff: components/payments/content/payment_request.cc

Issue 2870153002: [Payments] Record navigations that close the Payment Request as aborts. (Closed)
Patch Set: Addressed comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « components/payments/content/payment_request.h ('k') | components/payments/content/payment_request_web_contents_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698