| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/payments/core/journey_logger.h" | 5 #include "components/payments/core/journey_logger.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_functions.h" | 9 #include "base/metrics/histogram_functions.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 default: | 47 default: |
| 48 break; | 48 break; |
| 49 } | 49 } |
| 50 | 50 |
| 51 DCHECK(!name_suffix.empty()); | 51 DCHECK(!name_suffix.empty()); |
| 52 return name_suffix; | 52 return name_suffix; |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 JourneyLogger::JourneyLogger() | 57 JourneyLogger::JourneyLogger(bool is_incognito) |
| 58 : was_can_make_payments_used_(false), | 58 : was_can_make_payments_used_(false), |
| 59 could_make_payment_(false), | 59 could_make_payment_(false), |
| 60 was_show_called_(false) {} | 60 was_show_called_(false), |
| 61 is_incognito_(is_incognito) {} |
| 61 | 62 |
| 62 JourneyLogger::~JourneyLogger() {} | 63 JourneyLogger::~JourneyLogger() {} |
| 63 | 64 |
| 64 void JourneyLogger::IncrementSelectionAdds(Section section) { | 65 void JourneyLogger::IncrementSelectionAdds(Section section) { |
| 65 DCHECK_LT(section, SECTION_MAX); | 66 DCHECK_LT(section, SECTION_MAX); |
| 66 sections_[section].number_selection_adds_++; | 67 sections_[section].number_selection_adds_++; |
| 67 } | 68 } |
| 68 | 69 |
| 69 void JourneyLogger::IncrementSelectionChanges(Section section) { | 70 void JourneyLogger::IncrementSelectionChanges(Section section) { |
| 70 DCHECK_LT(section, SECTION_MAX); | 71 DCHECK_LT(section, SECTION_MAX); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } else { | 144 } else { |
| 144 base::UmaHistogramEnumeration( | 145 base::UmaHistogramEnumeration( |
| 145 "PaymentRequest.UserDidNotHaveSuggestionsForEverything." | 146 "PaymentRequest.UserDidNotHaveSuggestionsForEverything." |
| 146 "EffectOnCompletion", | 147 "EffectOnCompletion", |
| 147 completion_status, COMPLETION_STATUS_MAX); | 148 completion_status, COMPLETION_STATUS_MAX); |
| 148 } | 149 } |
| 149 } | 150 } |
| 150 | 151 |
| 151 void JourneyLogger::RecordCanMakePaymentStats( | 152 void JourneyLogger::RecordCanMakePaymentStats( |
| 152 CompletionStatus completion_status) { | 153 CompletionStatus completion_status) { |
| 154 // CanMakePayment always returns true in incognito mode. Don't log the |
| 155 // metrics. |
| 156 if (is_incognito_) |
| 157 return; |
| 158 |
| 153 // Record CanMakePayment usage. | 159 // Record CanMakePayment usage. |
| 154 UMA_HISTOGRAM_ENUMERATION("PaymentRequest.CanMakePayment.Usage", | 160 UMA_HISTOGRAM_ENUMERATION("PaymentRequest.CanMakePayment.Usage", |
| 155 was_can_make_payments_used_ | 161 was_can_make_payments_used_ |
| 156 ? CAN_MAKE_PAYMENT_USED | 162 ? CAN_MAKE_PAYMENT_USED |
| 157 : CAN_MAKE_PAYMENT_NOT_USED, | 163 : CAN_MAKE_PAYMENT_NOT_USED, |
| 158 CAN_MAKE_PAYMENT_USE_MAX); | 164 CAN_MAKE_PAYMENT_USE_MAX); |
| 159 | 165 |
| 160 RecordCanMakePaymentEffectOnShow(); | 166 RecordCanMakePaymentEffectOnShow(); |
| 161 RecordCanMakePaymentEffectOnCompletion(completion_status); | 167 RecordCanMakePaymentEffectOnCompletion(completion_status); |
| 162 } | 168 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 187 histogram_name += "Used.TrueWithShowEffectOnCompletion"; | 193 histogram_name += "Used.TrueWithShowEffectOnCompletion"; |
| 188 } else { | 194 } else { |
| 189 histogram_name += "Used.FalseWithShowEffectOnCompletion"; | 195 histogram_name += "Used.FalseWithShowEffectOnCompletion"; |
| 190 } | 196 } |
| 191 | 197 |
| 192 base::UmaHistogramEnumeration(histogram_name, completion_status, | 198 base::UmaHistogramEnumeration(histogram_name, completion_status, |
| 193 COMPLETION_STATUS_MAX); | 199 COMPLETION_STATUS_MAX); |
| 194 } | 200 } |
| 195 | 201 |
| 196 } // namespace payments | 202 } // namespace payments |
| OLD | NEW |