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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE); | 807 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE); |
808 } else if (logged_suggestion_filled_was_masked_server_card_) { | 808 } else if (logged_suggestion_filled_was_masked_server_card_) { |
809 Log(AutofillMetrics:: | 809 Log(AutofillMetrics:: |
810 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE); | 810 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE); |
811 } else if (logged_suggestion_filled_was_server_data_) { | 811 } else if (logged_suggestion_filled_was_server_data_) { |
812 Log(AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE); | 812 Log(AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE); |
813 } else { | 813 } else { |
814 Log(AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE); | 814 Log(AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE); |
815 } | 815 } |
816 | 816 |
| 817 if (has_logged_suggestions_shown_) { |
| 818 Log(AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE); |
| 819 } |
| 820 |
817 base::RecordAction(base::UserMetricsAction("Autofill_OnWillSubmitForm")); | 821 base::RecordAction(base::UserMetricsAction("Autofill_OnWillSubmitForm")); |
818 } | 822 } |
819 | 823 |
820 void AutofillMetrics::FormEventLogger::OnFormSubmitted() { | 824 void AutofillMetrics::FormEventLogger::OnFormSubmitted() { |
821 // Not logging this kind of form if we haven't logged a user interaction. | 825 // Not logging this kind of form if we haven't logged a user interaction. |
822 if (!has_logged_interacted_) | 826 if (!has_logged_interacted_) |
823 return; | 827 return; |
824 | 828 |
825 // Not logging twice. | 829 // Not logging twice. |
826 if (has_logged_submitted_) | 830 if (has_logged_submitted_) |
827 return; | 831 return; |
828 has_logged_submitted_ = true; | 832 has_logged_submitted_ = true; |
829 | 833 |
830 if (!has_logged_suggestion_filled_) { | 834 if (!has_logged_suggestion_filled_) { |
831 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE); | 835 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE); |
832 } else if (logged_suggestion_filled_was_masked_server_card_) { | 836 } else if (logged_suggestion_filled_was_masked_server_card_) { |
833 Log(AutofillMetrics | 837 Log(AutofillMetrics |
834 ::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE); | 838 ::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE); |
835 } else if (logged_suggestion_filled_was_server_data_) { | 839 } else if (logged_suggestion_filled_was_server_data_) { |
836 Log(AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE); | 840 Log(AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE); |
837 } else { | 841 } else { |
838 Log(AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE); | 842 Log(AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE); |
839 } | 843 } |
| 844 |
| 845 if (has_logged_suggestions_shown_) { |
| 846 Log(AutofillMetrics::FORM_EVENT_SUGGESTION_SHOWN_SUBMITTED_ONCE); |
| 847 } |
840 } | 848 } |
841 | 849 |
842 void AutofillMetrics::FormEventLogger::Log(FormEvent event) const { | 850 void AutofillMetrics::FormEventLogger::Log(FormEvent event) const { |
843 DCHECK_LT(event, NUM_FORM_EVENTS); | 851 DCHECK_LT(event, NUM_FORM_EVENTS); |
844 std::string name("Autofill.FormEvents."); | 852 std::string name("Autofill.FormEvents."); |
845 if (is_for_credit_card_) | 853 if (is_for_credit_card_) |
846 name += "CreditCard"; | 854 name += "CreditCard"; |
847 else | 855 else |
848 name += "Address"; | 856 name += "Address"; |
849 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); | 857 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); |
850 | 858 |
851 // Logging again in a different histogram for segmentation purposes. | 859 // Logging again in a different histogram for segmentation purposes. |
852 // TODO(waltercacau): Re-evaluate if we still need such fine grained | 860 // TODO(waltercacau): Re-evaluate if we still need such fine grained |
853 // segmentation. http://crbug.com/454018 | 861 // segmentation. http://crbug.com/454018 |
854 if (!is_server_data_available_ && !is_local_data_available_) | 862 if (!is_server_data_available_ && !is_local_data_available_) |
855 name += ".WithNoData"; | 863 name += ".WithNoData"; |
856 else if (is_server_data_available_ && !is_local_data_available_) | 864 else if (is_server_data_available_ && !is_local_data_available_) |
857 name += ".WithOnlyServerData"; | 865 name += ".WithOnlyServerData"; |
858 else if (!is_server_data_available_ && is_local_data_available_) | 866 else if (!is_server_data_available_ && is_local_data_available_) |
859 name += ".WithOnlyLocalData"; | 867 name += ".WithOnlyLocalData"; |
860 else | 868 else |
861 name += ".WithBothServerAndLocalData"; | 869 name += ".WithBothServerAndLocalData"; |
862 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); | 870 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); |
863 } | 871 } |
864 | 872 |
865 } // namespace autofill | 873 } // namespace autofill |
OLD | NEW |