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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 logged_suggestion_filled_was_masked_server_card_(false) { | 624 logged_suggestion_filled_was_masked_server_card_(false) { |
625 } | 625 } |
626 | 626 |
627 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() { | 627 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() { |
628 if (!has_logged_interacted_) { | 628 if (!has_logged_interacted_) { |
629 has_logged_interacted_ = true; | 629 has_logged_interacted_ = true; |
630 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE); | 630 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE); |
631 } | 631 } |
632 } | 632 } |
633 | 633 |
634 void AutofillMetrics::FormEventLogger::OnDidPollSuggestions() { | 634 void AutofillMetrics::FormEventLogger::OnDidPollSuggestions( |
635 if (is_for_credit_card_) { | 635 const FormFieldData& field) { |
636 base::RecordAction( | 636 // Record only one poll user action for consecutive polls of the same field. |
637 base::UserMetricsAction("Autofill_PolledCreditCardSuggestions")); | 637 // This is to avoid recording too many poll actions (for example when a user |
638 } else { | 638 // types in a field, triggering multiple queries) to make the analysis more |
639 base::RecordAction( | 639 // simple. |
640 base::UserMetricsAction("Autofill_PolledProfileSuggestions")); | 640 if (!field.SameFieldAs(last_polled_field_)) { |
| 641 if (is_for_credit_card_) { |
| 642 base::RecordAction( |
| 643 base::UserMetricsAction("Autofill_PolledCreditCardSuggestions")); |
| 644 } else { |
| 645 base::RecordAction( |
| 646 base::UserMetricsAction("Autofill_PolledProfileSuggestions")); |
| 647 } |
| 648 |
| 649 last_polled_field_ = field; |
641 } | 650 } |
642 } | 651 } |
643 | 652 |
644 void AutofillMetrics::FormEventLogger::OnDidShowSuggestions() { | 653 void AutofillMetrics::FormEventLogger::OnDidShowSuggestions() { |
645 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN); | 654 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN); |
646 if (!has_logged_suggestions_shown_) { | 655 if (!has_logged_suggestions_shown_) { |
647 has_logged_suggestions_shown_ = true; | 656 has_logged_suggestions_shown_ = true; |
648 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE); | 657 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE); |
649 } | 658 } |
650 | 659 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 else if (is_server_data_available_ && !is_local_data_available_) | 793 else if (is_server_data_available_ && !is_local_data_available_) |
785 name += ".WithOnlyServerData"; | 794 name += ".WithOnlyServerData"; |
786 else if (!is_server_data_available_ && is_local_data_available_) | 795 else if (!is_server_data_available_ && is_local_data_available_) |
787 name += ".WithOnlyLocalData"; | 796 name += ".WithOnlyLocalData"; |
788 else | 797 else |
789 name += ".WithBothServerAndLocalData"; | 798 name += ".WithBothServerAndLocalData"; |
790 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); | 799 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); |
791 } | 800 } |
792 | 801 |
793 } // namespace autofill | 802 } // namespace autofill |
OLD | NEW |