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

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

Issue 2870153002: [Payments] Record navigations that close the Payment Request as aborts. (Closed)
Patch Set: Fixed Windows error 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 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
« 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