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

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

Issue 2672623005: Record Autofill form events specially for nonsecure pages (Closed)
Patch Set: fix test added in rebase Created 3 years, 10 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
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 <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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 // static 686 // static
687 void AutofillMetrics::LogShowedHttpNotSecureExplanation() { 687 void AutofillMetrics::LogShowedHttpNotSecureExplanation() {
688 base::RecordAction( 688 base::RecordAction(
689 base::UserMetricsAction("Autofill_ShowedHttpNotSecureExplanation")); 689 base::UserMetricsAction("Autofill_ShowedHttpNotSecureExplanation"));
690 } 690 }
691 691
692 AutofillMetrics::FormEventLogger::FormEventLogger(bool is_for_credit_card) 692 AutofillMetrics::FormEventLogger::FormEventLogger(bool is_for_credit_card)
693 : is_for_credit_card_(is_for_credit_card), 693 : is_for_credit_card_(is_for_credit_card),
694 is_server_data_available_(false), 694 is_server_data_available_(false),
695 is_local_data_available_(false), 695 is_local_data_available_(false),
696 is_context_secure_(false),
696 has_logged_interacted_(false), 697 has_logged_interacted_(false),
697 has_logged_suggestions_shown_(false), 698 has_logged_suggestions_shown_(false),
698 has_logged_masked_server_card_suggestion_selected_(false), 699 has_logged_masked_server_card_suggestion_selected_(false),
699 has_logged_suggestion_filled_(false), 700 has_logged_suggestion_filled_(false),
700 has_logged_will_submit_(false), 701 has_logged_will_submit_(false),
701 has_logged_submitted_(false), 702 has_logged_submitted_(false),
702 logged_suggestion_filled_was_server_data_(false), 703 logged_suggestion_filled_was_server_data_(false),
703 logged_suggestion_filled_was_masked_server_card_(false) { 704 logged_suggestion_filled_was_masked_server_card_(false) {}
704 }
705 705
706 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() { 706 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() {
707 if (!has_logged_interacted_) { 707 if (!has_logged_interacted_) {
708 has_logged_interacted_ = true; 708 has_logged_interacted_ = true;
709 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE); 709 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE);
710 } 710 }
711 } 711 }
712 712
713 void AutofillMetrics::FormEventLogger::OnDidPollSuggestions( 713 void AutofillMetrics::FormEventLogger::OnDidPollSuggestions(
714 const FormFieldData& field) { 714 const FormFieldData& field) {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 863
864 void AutofillMetrics::FormEventLogger::Log(FormEvent event) const { 864 void AutofillMetrics::FormEventLogger::Log(FormEvent event) const {
865 DCHECK_LT(event, NUM_FORM_EVENTS); 865 DCHECK_LT(event, NUM_FORM_EVENTS);
866 std::string name("Autofill.FormEvents."); 866 std::string name("Autofill.FormEvents.");
867 if (is_for_credit_card_) 867 if (is_for_credit_card_)
868 name += "CreditCard"; 868 name += "CreditCard";
869 else 869 else
870 name += "Address"; 870 name += "Address";
871 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); 871 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS);
872 872
873 // Log again in a different histogram for credit card forms on nonsecure
874 // pages, so that form interactions on nonsecure pages can be analyzed on
875 // their own.
876 if (is_for_credit_card_ && !is_context_secure_) {
877 LogUMAHistogramEnumeration(name + ".OnNonsecurePage", event,
878 NUM_FORM_EVENTS);
879 }
880
873 // Logging again in a different histogram for segmentation purposes. 881 // Logging again in a different histogram for segmentation purposes.
874 // TODO(waltercacau): Re-evaluate if we still need such fine grained 882 // TODO(waltercacau): Re-evaluate if we still need such fine grained
875 // segmentation. http://crbug.com/454018 883 // segmentation. http://crbug.com/454018
876 if (!is_server_data_available_ && !is_local_data_available_) 884 if (!is_server_data_available_ && !is_local_data_available_)
877 name += ".WithNoData"; 885 name += ".WithNoData";
878 else if (is_server_data_available_ && !is_local_data_available_) 886 else if (is_server_data_available_ && !is_local_data_available_)
879 name += ".WithOnlyServerData"; 887 name += ".WithOnlyServerData";
880 else if (!is_server_data_available_ && is_local_data_available_) 888 else if (!is_server_data_available_ && is_local_data_available_)
881 name += ".WithOnlyLocalData"; 889 name += ".WithOnlyLocalData";
882 else 890 else
883 name += ".WithBothServerAndLocalData"; 891 name += ".WithBothServerAndLocalData";
884 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); 892 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS);
885 } 893 }
886 894
887 } // namespace autofill 895 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_metrics.h ('k') | components/autofill/core/browser/autofill_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698