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

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

Issue 2471263002: [Autofill] Add some missing types in autofill_metrics.cc (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/metrics/sparse_histogram.h" 11 #include "base/metrics/sparse_histogram.h"
12 #include "base/metrics/user_metrics.h" 12 #include "base/metrics/user_metrics.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "components/autofill/core/browser/autofill_type.h" 14 #include "components/autofill/core/browser/autofill_type.h"
15 #include "components/autofill/core/browser/form_structure.h" 15 #include "components/autofill/core/browser/form_structure.h"
16 #include "components/autofill/core/common/form_data.h" 16 #include "components/autofill/core/common/form_data.h"
17 17
18 namespace autofill { 18 namespace autofill {
19 19
20 namespace { 20 namespace {
21 21
22 // Note: if adding an enum value here, update the corresponding description for
23 // AutofillTypeQualityByFieldType in histograms.xml.
22 enum FieldTypeGroupForMetrics { 24 enum FieldTypeGroupForMetrics {
23 GROUP_AMBIGUOUS = 0, 25 GROUP_AMBIGUOUS = 0,
24 GROUP_NAME, 26 GROUP_NAME,
25 GROUP_COMPANY, 27 GROUP_COMPANY,
26 GROUP_ADDRESS_LINE_1, 28 GROUP_ADDRESS_LINE_1,
27 GROUP_ADDRESS_LINE_2, 29 GROUP_ADDRESS_LINE_2,
28 GROUP_ADDRESS_CITY, 30 GROUP_ADDRESS_CITY,
29 GROUP_ADDRESS_STATE, 31 GROUP_ADDRESS_STATE,
30 GROUP_ADDRESS_ZIP, 32 GROUP_ADDRESS_ZIP,
31 GROUP_ADDRESS_COUNTRY, 33 GROUP_ADDRESS_COUNTRY,
32 GROUP_PHONE, 34 GROUP_PHONE,
33 GROUP_FAX, // Deprecated. 35 GROUP_FAX, // Deprecated.
34 GROUP_EMAIL, 36 GROUP_EMAIL,
35 GROUP_CREDIT_CARD_NAME, 37 GROUP_CREDIT_CARD_NAME,
36 GROUP_CREDIT_CARD_NUMBER, 38 GROUP_CREDIT_CARD_NUMBER,
37 GROUP_CREDIT_CARD_DATE, 39 GROUP_CREDIT_CARD_DATE,
38 GROUP_CREDIT_CARD_TYPE, 40 GROUP_CREDIT_CARD_TYPE,
39 GROUP_PASSWORD, 41 GROUP_PASSWORD,
40 GROUP_ADDRESS_LINE_3, 42 GROUP_ADDRESS_LINE_3,
41 GROUP_USERNAME, 43 GROUP_USERNAME,
42 GROUP_STREET_ADDRESS, 44 GROUP_STREET_ADDRESS,
45 GROUP_CREDIT_CARD_VERIFICATION,
43 NUM_FIELD_TYPE_GROUPS_FOR_METRICS 46 NUM_FIELD_TYPE_GROUPS_FOR_METRICS
44 }; 47 };
45 48
46 } // namespace 49 } // namespace
47 50
48 // First, translates |field_type| to the corresponding logical |group| from 51 // First, translates |field_type| to the corresponding logical |group| from
49 // |FieldTypeGroupForMetrics|. Then, interpolates this with the given |metric|, 52 // |FieldTypeGroupForMetrics|. Then, interpolates this with the given |metric|,
50 // which should be in the range [0, |num_possible_metrics|). 53 // which should be in the range [0, |num_possible_metrics|).
51 // Returns the interpolated index. 54 // Returns the interpolated index.
52 // 55 //
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 case ADDRESS_HOME_STATE: 112 case ADDRESS_HOME_STATE:
110 group = GROUP_ADDRESS_STATE; 113 group = GROUP_ADDRESS_STATE;
111 break; 114 break;
112 case ADDRESS_HOME_ZIP: 115 case ADDRESS_HOME_ZIP:
113 group = GROUP_ADDRESS_ZIP; 116 group = GROUP_ADDRESS_ZIP;
114 break; 117 break;
115 case ADDRESS_HOME_COUNTRY: 118 case ADDRESS_HOME_COUNTRY:
116 group = GROUP_ADDRESS_COUNTRY; 119 group = GROUP_ADDRESS_COUNTRY;
117 break; 120 break;
118 default: 121 default:
119 NOTREACHED(); 122 NOTREACHED() << field_type << " has no group assigned (ambiguous)";
120 group = GROUP_AMBIGUOUS; 123 group = GROUP_AMBIGUOUS;
121 break; 124 break;
122 } 125 }
123 break; 126 break;
124 127
125 case EMAIL: 128 case EMAIL:
126 group = GROUP_EMAIL; 129 group = GROUP_EMAIL;
127 break; 130 break;
128 131
129 case PHONE_HOME: 132 case PHONE_HOME:
(...skipping 14 matching lines...) Expand all
144 case CREDIT_CARD_TYPE: 147 case CREDIT_CARD_TYPE:
145 group = GROUP_CREDIT_CARD_TYPE; 148 group = GROUP_CREDIT_CARD_TYPE;
146 break; 149 break;
147 case CREDIT_CARD_EXP_MONTH: 150 case CREDIT_CARD_EXP_MONTH:
148 case CREDIT_CARD_EXP_2_DIGIT_YEAR: 151 case CREDIT_CARD_EXP_2_DIGIT_YEAR:
149 case CREDIT_CARD_EXP_4_DIGIT_YEAR: 152 case CREDIT_CARD_EXP_4_DIGIT_YEAR:
150 case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR: 153 case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR:
151 case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR: 154 case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR:
152 group = GROUP_CREDIT_CARD_DATE; 155 group = GROUP_CREDIT_CARD_DATE;
153 break; 156 break;
157 case CREDIT_CARD_VERIFICATION_CODE:
158 group = GROUP_CREDIT_CARD_VERIFICATION;
159 break;
154 default: 160 default:
155 NOTREACHED(); 161 NOTREACHED() << field_type << " has no group assigned (ambiguous)";
156 group = GROUP_AMBIGUOUS; 162 group = GROUP_AMBIGUOUS;
157 break; 163 break;
158 } 164 }
159 break; 165 break;
160 166
161 case PASSWORD_FIELD: 167 case PASSWORD_FIELD:
162 group = GROUP_PASSWORD; 168 group = GROUP_PASSWORD;
163 break; 169 break;
164 170
165 case USERNAME_FIELD: 171 case USERNAME_FIELD:
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 else if (is_server_data_available_ && !is_local_data_available_) 856 else if (is_server_data_available_ && !is_local_data_available_)
851 name += ".WithOnlyServerData"; 857 name += ".WithOnlyServerData";
852 else if (!is_server_data_available_ && is_local_data_available_) 858 else if (!is_server_data_available_ && is_local_data_available_)
853 name += ".WithOnlyLocalData"; 859 name += ".WithOnlyLocalData";
854 else 860 else
855 name += ".WithBothServerAndLocalData"; 861 name += ".WithBothServerAndLocalData";
856 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); 862 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS);
857 } 863 }
858 864
859 } // namespace autofill 865 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698