| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 // static | 678 // static |
| 679 void AutofillMetrics::LogShowedHttpNotSecureExplanation() { | 679 void AutofillMetrics::LogShowedHttpNotSecureExplanation() { |
| 680 base::RecordAction( | 680 base::RecordAction( |
| 681 base::UserMetricsAction("Autofill_ShowedHttpNotSecureExplanation")); | 681 base::UserMetricsAction("Autofill_ShowedHttpNotSecureExplanation")); |
| 682 } | 682 } |
| 683 | 683 |
| 684 AutofillMetrics::FormEventLogger::FormEventLogger(bool is_for_credit_card) | 684 AutofillMetrics::FormEventLogger::FormEventLogger(bool is_for_credit_card) |
| 685 : is_for_credit_card_(is_for_credit_card), | 685 : is_for_credit_card_(is_for_credit_card), |
| 686 is_server_data_available_(false), | 686 is_server_data_available_(false), |
| 687 is_local_data_available_(false), | 687 is_local_data_available_(false), |
| 688 is_context_secure_(false), |
| 688 has_logged_interacted_(false), | 689 has_logged_interacted_(false), |
| 689 has_logged_suggestions_shown_(false), | 690 has_logged_suggestions_shown_(false), |
| 690 has_logged_masked_server_card_suggestion_selected_(false), | 691 has_logged_masked_server_card_suggestion_selected_(false), |
| 691 has_logged_suggestion_filled_(false), | 692 has_logged_suggestion_filled_(false), |
| 692 has_logged_will_submit_(false), | 693 has_logged_will_submit_(false), |
| 693 has_logged_submitted_(false), | 694 has_logged_submitted_(false), |
| 694 logged_suggestion_filled_was_server_data_(false), | 695 logged_suggestion_filled_was_server_data_(false), |
| 695 logged_suggestion_filled_was_masked_server_card_(false) { | 696 logged_suggestion_filled_was_masked_server_card_(false) {} |
| 696 } | |
| 697 | 697 |
| 698 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() { | 698 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() { |
| 699 if (!has_logged_interacted_) { | 699 if (!has_logged_interacted_) { |
| 700 has_logged_interacted_ = true; | 700 has_logged_interacted_ = true; |
| 701 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE); | 701 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE); |
| 702 } | 702 } |
| 703 } | 703 } |
| 704 | 704 |
| 705 void AutofillMetrics::FormEventLogger::OnDidPollSuggestions( | 705 void AutofillMetrics::FormEventLogger::OnDidPollSuggestions( |
| 706 const FormFieldData& field) { | 706 const FormFieldData& field) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 | 855 |
| 856 void AutofillMetrics::FormEventLogger::Log(FormEvent event) const { | 856 void AutofillMetrics::FormEventLogger::Log(FormEvent event) const { |
| 857 DCHECK_LT(event, NUM_FORM_EVENTS); | 857 DCHECK_LT(event, NUM_FORM_EVENTS); |
| 858 std::string name("Autofill.FormEvents."); | 858 std::string name("Autofill.FormEvents."); |
| 859 if (is_for_credit_card_) | 859 if (is_for_credit_card_) |
| 860 name += "CreditCard"; | 860 name += "CreditCard"; |
| 861 else | 861 else |
| 862 name += "Address"; | 862 name += "Address"; |
| 863 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); | 863 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); |
| 864 | 864 |
| 865 // Log again in a different histogram for credit card forms on nonsecure |
| 866 // pages, so that form interactions on nonsecure pages can be analyzed on |
| 867 // their own. |
| 868 if (is_for_credit_card_ && !is_context_secure_) { |
| 869 LogUMAHistogramEnumeration(name + ".OnNonsecurePage", event, |
| 870 NUM_FORM_EVENTS); |
| 871 } |
| 872 |
| 865 // Logging again in a different histogram for segmentation purposes. | 873 // Logging again in a different histogram for segmentation purposes. |
| 866 // TODO(waltercacau): Re-evaluate if we still need such fine grained | 874 // TODO(waltercacau): Re-evaluate if we still need such fine grained |
| 867 // segmentation. http://crbug.com/454018 | 875 // segmentation. http://crbug.com/454018 |
| 868 if (!is_server_data_available_ && !is_local_data_available_) | 876 if (!is_server_data_available_ && !is_local_data_available_) |
| 869 name += ".WithNoData"; | 877 name += ".WithNoData"; |
| 870 else if (is_server_data_available_ && !is_local_data_available_) | 878 else if (is_server_data_available_ && !is_local_data_available_) |
| 871 name += ".WithOnlyServerData"; | 879 name += ".WithOnlyServerData"; |
| 872 else if (!is_server_data_available_ && is_local_data_available_) | 880 else if (!is_server_data_available_ && is_local_data_available_) |
| 873 name += ".WithOnlyLocalData"; | 881 name += ".WithOnlyLocalData"; |
| 874 else | 882 else |
| 875 name += ".WithBothServerAndLocalData"; | 883 name += ".WithBothServerAndLocalData"; |
| 876 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); | 884 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); |
| 877 } | 885 } |
| 878 | 886 |
| 879 } // namespace autofill | 887 } // namespace autofill |
| OLD | NEW |