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

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

Issue 21947003: [Autofill] Move FieldTypeGroup out of the AutofillType class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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 | Annotate | Revision Log
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "components/autofill/core/browser/autofill_type.h" 10 #include "components/autofill/core/browser/autofill_type.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // 79 //
80 // Clients must ensure that |field_type| is one of the types Chrome supports 80 // Clients must ensure that |field_type| is one of the types Chrome supports
81 // natively, e.g. |field_type| must not be a billng address. 81 // natively, e.g. |field_type| must not be a billng address.
82 int GetFieldTypeGroupMetric(const AutofillFieldType field_type, 82 int GetFieldTypeGroupMetric(const AutofillFieldType field_type,
83 const int metric, 83 const int metric,
84 const int num_possible_metrics) { 84 const int num_possible_metrics) {
85 DCHECK_LT(metric, num_possible_metrics); 85 DCHECK_LT(metric, num_possible_metrics);
86 86
87 FieldTypeGroupForMetrics group; 87 FieldTypeGroupForMetrics group;
88 switch (AutofillType(field_type).group()) { 88 switch (AutofillType(field_type).group()) {
89 case AutofillType::NO_GROUP: 89 case ::autofill::NO_GROUP:
90 group = AMBIGUOUS; 90 group = AMBIGUOUS;
91 break; 91 break;
92 92
93 case AutofillType::NAME: 93 case ::autofill::NAME:
94 group = NAME; 94 group = NAME;
95 break; 95 break;
96 96
97 case AutofillType::COMPANY: 97 case ::autofill::COMPANY:
98 group = COMPANY; 98 group = COMPANY;
99 break; 99 break;
100 100
101 case AutofillType::ADDRESS_HOME: 101 case ::autofill::ADDRESS_HOME:
102 switch (field_type) { 102 switch (field_type) {
103 case ADDRESS_HOME_LINE1: 103 case ADDRESS_HOME_LINE1:
104 group = ADDRESS_LINE_1; 104 group = ADDRESS_LINE_1;
105 break; 105 break;
106 case ADDRESS_HOME_LINE2: 106 case ADDRESS_HOME_LINE2:
107 group = ADDRESS_LINE_2; 107 group = ADDRESS_LINE_2;
108 break; 108 break;
109 case ADDRESS_HOME_CITY: 109 case ADDRESS_HOME_CITY:
110 group = ADDRESS_CITY; 110 group = ADDRESS_CITY;
111 break; 111 break;
112 case ADDRESS_HOME_STATE: 112 case ADDRESS_HOME_STATE:
113 group = ADDRESS_STATE; 113 group = ADDRESS_STATE;
114 break; 114 break;
115 case ADDRESS_HOME_ZIP: 115 case ADDRESS_HOME_ZIP:
116 group = ADDRESS_ZIP; 116 group = ADDRESS_ZIP;
117 break; 117 break;
118 case ADDRESS_HOME_COUNTRY: 118 case ADDRESS_HOME_COUNTRY:
119 group = ADDRESS_COUNTRY; 119 group = ADDRESS_COUNTRY;
120 break; 120 break;
121 default: 121 default:
122 NOTREACHED(); 122 NOTREACHED();
123 group = AMBIGUOUS; 123 group = AMBIGUOUS;
124 } 124 }
125 break; 125 break;
126 126
127 case AutofillType::EMAIL: 127 case ::autofill::EMAIL:
128 group = EMAIL; 128 group = EMAIL;
129 break; 129 break;
130 130
131 case AutofillType::PHONE_HOME: 131 case ::autofill::PHONE_HOME:
132 group = PHONE; 132 group = PHONE;
133 break; 133 break;
134 134
135 case AutofillType::CREDIT_CARD: 135 case ::autofill::CREDIT_CARD:
136 switch (field_type) { 136 switch (field_type) {
137 case ::autofill::CREDIT_CARD_NAME: 137 case ::autofill::CREDIT_CARD_NAME:
138 group = CREDIT_CARD_NAME; 138 group = CREDIT_CARD_NAME;
139 break; 139 break;
140 case ::autofill::CREDIT_CARD_NUMBER: 140 case ::autofill::CREDIT_CARD_NUMBER:
141 group = CREDIT_CARD_NUMBER; 141 group = CREDIT_CARD_NUMBER;
142 break; 142 break;
143 case ::autofill::CREDIT_CARD_TYPE: 143 case ::autofill::CREDIT_CARD_TYPE:
144 group = CREDIT_CARD_TYPE; 144 group = CREDIT_CARD_TYPE;
145 default: 145 default:
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 const std::string& experiment_id) const { 589 const std::string& experiment_id) const {
590 LogServerExperimentId("Autofill.ServerExperimentId.Query", experiment_id); 590 LogServerExperimentId("Autofill.ServerExperimentId.Query", experiment_id);
591 } 591 }
592 592
593 void AutofillMetrics::LogServerExperimentIdForUpload( 593 void AutofillMetrics::LogServerExperimentIdForUpload(
594 const std::string& experiment_id) const { 594 const std::string& experiment_id) const {
595 LogServerExperimentId("Autofill.ServerExperimentId.Upload", experiment_id); 595 LogServerExperimentId("Autofill.ServerExperimentId.Upload", experiment_id);
596 } 596 }
597 597
598 } // namespace autofill 598 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | components/autofill/core/browser/autofill_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698