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

Side by Side Diff: components/autofill/core/browser/autofill_metrics.cc

Issue 23537014: rAc: Get rid of dialog type in rAc, there is only one type left now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/autofill/core/browser/autofill_metrics.h" 5 #include "components/autofill/core/browser/autofill_metrics.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "components/autofill/core/browser/autofill_type.h" 10 #include "components/autofill/core/browser/autofill_type.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 default: 151 default:
152 NOTREACHED(); 152 NOTREACHED();
153 group = AMBIGUOUS; 153 group = AMBIGUOUS;
154 } 154 }
155 155
156 // Interpolate the |metric| with the |group|, so that all metrics for a given 156 // Interpolate the |metric| with the |group|, so that all metrics for a given
157 // |group| are adjacent. 157 // |group| are adjacent.
158 return (group * num_possible_metrics) + metric; 158 return (group * num_possible_metrics) + metric;
159 } 159 }
160 160
161 // Returns the histogram prefix to use for reporting metrics for |dialog_type|.
162 std::string GetPrefixForDialogType(autofill::DialogType dialog_type) {
163 switch (dialog_type) {
164 case autofill::DIALOG_TYPE_AUTOCHECKOUT:
165 return "Autocheckout";
166
167 case autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE:
168 return "RequestAutocomplete";
169 }
170
171 NOTREACHED();
172 return "UnknownDialogType";
173 }
174
175 std::string WalletApiMetricToString( 161 std::string WalletApiMetricToString(
176 AutofillMetrics::WalletApiCallMetric metric) { 162 AutofillMetrics::WalletApiCallMetric metric) {
177 switch (metric) { 163 switch (metric) {
178 case AutofillMetrics::ACCEPT_LEGAL_DOCUMENTS: 164 case AutofillMetrics::ACCEPT_LEGAL_DOCUMENTS:
179 return "AcceptLegalDocuments"; 165 return "AcceptLegalDocuments";
180 case AutofillMetrics::AUTHENTICATE_INSTRUMENT: 166 case AutofillMetrics::AUTHENTICATE_INSTRUMENT:
181 return "AuthenticateInstrument"; 167 return "AuthenticateInstrument";
182 case AutofillMetrics::GET_FULL_WALLET: 168 case AutofillMetrics::GET_FULL_WALLET:
183 return "GetFullWallet"; 169 return "GetFullWallet";
184 case AutofillMetrics::GET_WALLET_ITEMS: 170 case AutofillMetrics::GET_WALLET_ITEMS:
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 310 }
325 311
326 void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric) const { 312 void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric) const {
327 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); 313 DCHECK_LT(metric, NUM_INFO_BAR_METRICS);
328 314
329 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar", metric, 315 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar", metric,
330 NUM_INFO_BAR_METRICS); 316 NUM_INFO_BAR_METRICS);
331 } 317 }
332 318
333 void AutofillMetrics::LogDialogDismissalState( 319 void AutofillMetrics::LogDialogDismissalState(
334 autofill::DialogType dialog_type,
335 DialogDismissalState state) const { 320 DialogDismissalState state) const {
336 std::string name = GetPrefixForDialogType(dialog_type) + ".DismissalState"; 321 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.DismissalState",
337 LogUMAHistogramEnumeration(name, state, NUM_DIALOG_DISMISSAL_STATES); 322 state, NUM_DIALOG_DISMISSAL_STATES);
338 } 323 }
339 324
340 void AutofillMetrics::LogDialogInitialUserState( 325 void AutofillMetrics::LogDialogInitialUserState(
341 autofill::DialogType dialog_type,
342 DialogInitialUserStateMetric user_type) const { 326 DialogInitialUserStateMetric user_type) const {
343 std::string name = GetPrefixForDialogType(dialog_type) + ".InitialUserState"; 327 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.InitialUserState",
344 LogUMAHistogramEnumeration( 328 user_type, NUM_DIALOG_INITIAL_USER_STATE_METRICS);
345 name, user_type, NUM_DIALOG_INITIAL_USER_STATE_METRICS);
346 } 329 }
347 330
348 void AutofillMetrics::LogDialogLatencyToShow( 331 void AutofillMetrics::LogDialogLatencyToShow(
349 autofill::DialogType dialog_type,
350 const base::TimeDelta& duration) const { 332 const base::TimeDelta& duration) const {
351 std::string name = 333 LogUMAHistogramTimes("RequestAutocomplete.UiLatencyToShow", duration);
352 GetPrefixForDialogType(dialog_type) + ".UiLatencyToShow";
353 LogUMAHistogramTimes(name, duration);
354 } 334 }
355 335
356 void AutofillMetrics::LogDialogPopupEvent(autofill::DialogType dialog_type, 336 void AutofillMetrics::LogDialogPopupEvent(DialogPopupEvent event) const {
357 DialogPopupEvent event) const { 337 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.PopupInDialog",
358 std::string name = GetPrefixForDialogType(dialog_type) + ".PopupInDialog"; 338 event, NUM_DIALOG_POPUP_EVENTS);
359 LogUMAHistogramEnumeration(name, event, NUM_DIALOG_POPUP_EVENTS);
360 } 339 }
361 340
362 void AutofillMetrics::LogDialogSecurityMetric( 341 void AutofillMetrics::LogDialogSecurityMetric(
363 autofill::DialogType dialog_type,
364 DialogSecurityMetric metric) const { 342 DialogSecurityMetric metric) const {
365 std::string name = GetPrefixForDialogType(dialog_type) + ".Security"; 343 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.Security",
366 LogUMAHistogramEnumeration(name, metric, NUM_DIALOG_SECURITY_METRICS); 344 metric, NUM_DIALOG_SECURITY_METRICS);
367 } 345 }
368 346
369 void AutofillMetrics::LogDialogUiDuration( 347 void AutofillMetrics::LogDialogUiDuration(
370 const base::TimeDelta& duration, 348 const base::TimeDelta& duration,
371 autofill::DialogType dialog_type,
372 DialogDismissalAction dismissal_action) const { 349 DialogDismissalAction dismissal_action) const {
373 std::string prefix = GetPrefixForDialogType(dialog_type);
374
375 std::string suffix; 350 std::string suffix;
376 switch (dismissal_action) { 351 switch (dismissal_action) {
377 case DIALOG_ACCEPTED: 352 case DIALOG_ACCEPTED:
378 suffix = "Submit"; 353 suffix = "Submit";
379 break; 354 break;
380 355
381 case DIALOG_CANCELED: 356 case DIALOG_CANCELED:
382 suffix = "Cancel"; 357 suffix = "Cancel";
383 break; 358 break;
384 } 359 }
385 360
386 LogUMAHistogramLongTimes(prefix + ".UiDuration", duration); 361 LogUMAHistogramLongTimes("RequestAutocomplete.UiDuration", duration);
387 LogUMAHistogramLongTimes(prefix + ".UiDuration." + suffix, duration); 362 LogUMAHistogramLongTimes("RequestAutocomplete.UiDuration." + suffix,
363 duration);
388 } 364 }
389 365
390 void AutofillMetrics::LogDialogUiEvent(autofill::DialogType dialog_type, 366 void AutofillMetrics::LogDialogUiEvent(DialogUiEvent event) const {
391 DialogUiEvent event) const { 367 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.UiEvents", event,
392 std::string name = GetPrefixForDialogType(dialog_type) + ".UiEvents"; 368 NUM_DIALOG_UI_EVENTS);
393 LogUMAHistogramEnumeration(name, event, NUM_DIALOG_UI_EVENTS);
394 } 369 }
395 370
396 void AutofillMetrics::LogWalletErrorMetric(autofill::DialogType dialog_type, 371 void AutofillMetrics::LogWalletErrorMetric(WalletErrorMetric metric) const {
397 WalletErrorMetric metric) const { 372 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.WalletErrors", metric,
398 std::string name = GetPrefixForDialogType(dialog_type) + ".WalletErrors"; 373 NUM_WALLET_ERROR_METRICS);
399 LogUMAHistogramEnumeration(name, metric, NUM_WALLET_ERROR_METRICS);
400 } 374 }
401 375
402 void AutofillMetrics::LogWalletApiCallDuration( 376 void AutofillMetrics::LogWalletApiCallDuration(
403 WalletApiCallMetric metric, 377 WalletApiCallMetric metric,
404 const base::TimeDelta& duration) const { 378 const base::TimeDelta& duration) const {
405 LogUMAHistogramTimes("Wallet.ApiCallDuration." + 379 LogUMAHistogramTimes("Wallet.ApiCallDuration." +
406 WalletApiMetricToString(metric), duration); 380 WalletApiMetricToString(metric), duration);
407 } 381 }
408 382
409 void AutofillMetrics::LogWalletRequiredActionMetric( 383 void AutofillMetrics::LogWalletRequiredActionMetric(
410 autofill::DialogType dialog_type,
411 WalletRequiredActionMetric required_action) const { 384 WalletRequiredActionMetric required_action) const {
412 std::string name = 385 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.WalletRequiredActions",
413 GetPrefixForDialogType(dialog_type) + ".WalletRequiredActions"; 386 required_action, NUM_WALLET_REQUIRED_ACTIONS);
414 LogUMAHistogramEnumeration(
415 name, required_action, NUM_WALLET_REQUIRED_ACTIONS);
416 } 387 }
417 388
418 void AutofillMetrics::LogDeveloperEngagementMetric( 389 void AutofillMetrics::LogDeveloperEngagementMetric(
419 DeveloperEngagementMetric metric) const { 390 DeveloperEngagementMetric metric) const {
420 DCHECK_LT(metric, NUM_DEVELOPER_ENGAGEMENT_METRICS); 391 DCHECK_LT(metric, NUM_DEVELOPER_ENGAGEMENT_METRICS);
421 392
422 UMA_HISTOGRAM_ENUMERATION("Autofill.DeveloperEngagement", metric, 393 UMA_HISTOGRAM_ENUMERATION("Autofill.DeveloperEngagement", metric,
423 NUM_DEVELOPER_ENGAGEMENT_METRICS); 394 NUM_DEVELOPER_ENGAGEMENT_METRICS);
424 } 395 }
425 396
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 const std::string& experiment_id) const { 504 const std::string& experiment_id) const {
534 LogServerExperimentId("Autofill.ServerExperimentId.Query", experiment_id); 505 LogServerExperimentId("Autofill.ServerExperimentId.Query", experiment_id);
535 } 506 }
536 507
537 void AutofillMetrics::LogServerExperimentIdForUpload( 508 void AutofillMetrics::LogServerExperimentIdForUpload(
538 const std::string& experiment_id) const { 509 const std::string& experiment_id) const {
539 LogServerExperimentId("Autofill.ServerExperimentId.Upload", experiment_id); 510 LogServerExperimentId("Autofill.ServerExperimentId.Upload", experiment_id);
540 } 511 }
541 512
542 } // namespace autofill 513 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_metrics.h ('k') | components/autofill/core/browser/test_autofill_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698