Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 458 // static | 458 // static |
| 459 void AutofillMetrics::LogStoredProfileCount(size_t num_profiles) { | 459 void AutofillMetrics::LogStoredProfileCount(size_t num_profiles) { |
| 460 UMA_HISTOGRAM_COUNTS("Autofill.StoredProfileCount", num_profiles); | 460 UMA_HISTOGRAM_COUNTS("Autofill.StoredProfileCount", num_profiles); |
| 461 } | 461 } |
| 462 | 462 |
| 463 // static | 463 // static |
| 464 void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) { | 464 void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) { |
| 465 UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions); | 465 UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions); |
| 466 } | 466 } |
| 467 | 467 |
| 468 AutofillMetrics::FormEventLogger::FormEventLogger(bool is_for_credit_card) | |
| 469 : is_for_credit_card_(is_for_credit_card), | |
| 470 is_server_data_available_(false), | |
| 471 is_local_data_available_(false), | |
| 472 has_logged_interacted_(false) {}; | |
| 473 | |
| 474 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() { | |
| 475 if (!has_logged_interacted_) { | |
| 476 has_logged_interacted_ = true; | |
| 477 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE); | |
| 478 } | |
| 479 } | |
| 480 | |
| 481 void AutofillMetrics::FormEventLogger::Log(FormEvent event) const { | |
| 482 DCHECK_LT(event, NUM_FORM_EVENTS); | |
| 483 std::string name("Autofill.FormEvents."); | |
| 484 if (is_for_credit_card_) { | |
|
Evan Stade
2015/02/03 01:51:36
no curlies
Walter Cacau
2015/02/03 02:15:25
Done.
| |
| 485 name += "CreditCard"; | |
| 486 } else { | |
| 487 name += "Address"; | |
| 488 } | |
| 489 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); | |
| 490 | |
| 491 // Logging again in a different histogram for segmentation purposes. | |
| 492 // TODO(waltercacau): Re-evaluate if we still need such fine grained | |
| 493 // segmentation. http://crbug.com/454018 | |
| 494 if (!is_server_data_available_ && !is_local_data_available_) { | |
|
Evan Stade
2015/02/03 01:51:36
no curlies for any of this block
Walter Cacau
2015/02/03 02:15:25
Done.
| |
| 495 name += ".WithNoData"; | |
| 496 } else if (is_server_data_available_ && !is_local_data_available_) { | |
| 497 name += ".WithOnlyServerData"; | |
| 498 } else if (!is_server_data_available_ && is_local_data_available_) { | |
| 499 name += ".WithOnlyLocalData"; | |
| 500 } else { | |
| 501 name += ".WithBothServerAndLocalData"; | |
| 502 } | |
| 503 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); | |
| 504 } | |
| 505 | |
| 468 } // namespace autofill | 506 } // namespace autofill |
| OLD | NEW |