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

Side by Side Diff: components/payments/core/journey_logger.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: simplify type checking Created 3 years, 5 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 unified diff | Download patch
OLDNEW
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 UMA_HISTOGRAM_BOOLEAN("PaymentRequest.CheckoutFunnel.SkippedShow", true); 196 UMA_HISTOGRAM_BOOLEAN("PaymentRequest.CheckoutFunnel.SkippedShow", true);
197 } 197 }
198 198
199 void JourneyLogger::RecordPaymentMethodMetric() { 199 void JourneyLogger::RecordPaymentMethodMetric() {
200 base::UmaHistogramEnumeration("PaymentRequest.SelectedPaymentMethod", 200 base::UmaHistogramEnumeration("PaymentRequest.SelectedPaymentMethod",
201 payment_method_, SELECTED_PAYMENT_METHOD_MAX); 201 payment_method_, SELECTED_PAYMENT_METHOD_MAX);
202 } 202 }
203 203
204 void JourneyLogger::RecordRequestedInformationMetrics() { 204 void JourneyLogger::RecordRequestedInformationMetrics() {
205 DCHECK(requested_information_ != REQUESTED_INFORMATION_MAX); 205 DCHECK(requested_information_ != REQUESTED_INFORMATION_MAX);
206 UMA_HISTOGRAM_ENUMERATION("PaymentRequest.RequestedInformation", 206 UMA_HISTOGRAM_ENUMERATION(
207 requested_information_, REQUESTED_INFORMATION_MAX); 207 "PaymentRequest.RequestedInformation",
208 static_cast<RequestedInformation>(requested_information_),
209 REQUESTED_INFORMATION_MAX);
208 } 210 }
209 211
210 void JourneyLogger::RecordSectionSpecificStats( 212 void JourneyLogger::RecordSectionSpecificStats(
211 CompletionStatus completion_status) { 213 CompletionStatus completion_status) {
212 // Record whether the user had suggestions for each requested information. 214 // Record whether the user had suggestions for each requested information.
213 bool user_had_all_requested_information = true; 215 bool user_had_all_requested_information = true;
214 216
215 for (int i = 0; i < NUMBER_OF_SECTIONS; ++i) { 217 for (int i = 0; i < NUMBER_OF_SECTIONS; ++i) {
216 std::string name_suffix = GetHistogramNameSuffix(i, completion_status); 218 std::string name_suffix = GetHistogramNameSuffix(i, completion_status);
217 219
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 if (!was_can_make_payments_used_) 293 if (!was_can_make_payments_used_)
292 return; 294 return;
293 295
294 int effect_on_show = 0; 296 int effect_on_show = 0;
295 if (was_show_called_) 297 if (was_show_called_)
296 effect_on_show |= CMP_EFFECT_ON_SHOW_DID_SHOW; 298 effect_on_show |= CMP_EFFECT_ON_SHOW_DID_SHOW;
297 if (could_make_payment_) 299 if (could_make_payment_)
298 effect_on_show |= CMP_EFFECT_ON_SHOW_COULD_MAKE_PAYMENT; 300 effect_on_show |= CMP_EFFECT_ON_SHOW_COULD_MAKE_PAYMENT;
299 301
300 UMA_HISTOGRAM_ENUMERATION("PaymentRequest.CanMakePayment.Used.EffectOnShow", 302 UMA_HISTOGRAM_ENUMERATION("PaymentRequest.CanMakePayment.Used.EffectOnShow",
301 effect_on_show, CMP_EFFECT_ON_SHOW_MAX); 303 static_cast<CmpEffectOnShow>(effect_on_show),
304 CMP_EFFECT_ON_SHOW_MAX);
302 } 305 }
303 306
304 void JourneyLogger::RecordCanMakePaymentEffectOnCompletion( 307 void JourneyLogger::RecordCanMakePaymentEffectOnCompletion(
305 CompletionStatus completion_status) { 308 CompletionStatus completion_status) {
306 if (!was_show_called_) 309 if (!was_show_called_)
307 return; 310 return;
308 311
309 std::string histogram_name = "PaymentRequest.CanMakePayment."; 312 std::string histogram_name = "PaymentRequest.CanMakePayment.";
310 if (!was_can_make_payments_used_) { 313 if (!was_can_make_payments_used_) {
311 histogram_name += "NotUsed.WithShowEffectOnCompletion"; 314 histogram_name += "NotUsed.WithShowEffectOnCompletion";
(...skipping 16 matching lines...) Expand all
328 ukm_recorder_->UpdateSourceURL(source_id, url_); 331 ukm_recorder_->UpdateSourceURL(source_id, url_);
329 std::unique_ptr<ukm::UkmEntryBuilder> builder = 332 std::unique_ptr<ukm::UkmEntryBuilder> builder =
330 ukm_recorder_->GetEntryBuilder(source_id, 333 ukm_recorder_->GetEntryBuilder(source_id,
331 internal::kUKMCheckoutEventsEntryName); 334 internal::kUKMCheckoutEventsEntryName);
332 builder->AddMetric(internal::kUKMCompletionStatusMetricName, 335 builder->AddMetric(internal::kUKMCompletionStatusMetricName,
333 completion_status); 336 completion_status);
334 builder->AddMetric(internal::kUKMEventsMetricName, events_); 337 builder->AddMetric(internal::kUKMEventsMetricName, events_);
335 } 338 }
336 339
337 } // namespace payments 340 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698