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

Side by Side Diff: chrome/browser/autofill/form_structure.cc

Issue 5703002: Add some basic success/failure UMA logging for autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forbid copying, assignments (just like in, school) Created 10 years 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
« no previous file with comments | « chrome/browser/autofill/form_structure.h ('k') | chrome/chrome_tests.gypi » ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/autofill/form_structure.h" 5 #include "chrome/browser/autofill/form_structure.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/sha1.h" 9 #include "base/sha1.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Obtain the XML structure as a string. 187 // Obtain the XML structure as a string.
188 *encoded_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; 188 *encoded_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
189 *encoded_xml += autofil_request_xml.Str().c_str(); 189 *encoded_xml += autofil_request_xml.Str().c_str();
190 190
191 return true; 191 return true;
192 } 192 }
193 193
194 // static 194 // static
195 void FormStructure::ParseQueryResponse(const std::string& response_xml, 195 void FormStructure::ParseQueryResponse(const std::string& response_xml,
196 const std::vector<FormStructure*>& forms, 196 const std::vector<FormStructure*>& forms,
197 UploadRequired* upload_required) { 197 UploadRequired* upload_required,
198 autofill_metrics::LogServerQueryMetric( 198 const AutoFillMetrics& metric_logger) {
199 autofill_metrics::QUERY_RESPONSE_RECEIVED); 199 metric_logger.Log(AutoFillMetrics::QUERY_RESPONSE_RECEIVED);
200 200
201 // Parse the field types from the server response to the query. 201 // Parse the field types from the server response to the query.
202 std::vector<AutoFillFieldType> field_types; 202 std::vector<AutoFillFieldType> field_types;
203 AutoFillQueryXmlParser parse_handler(&field_types, upload_required); 203 AutoFillQueryXmlParser parse_handler(&field_types, upload_required);
204 buzz::XmlParser parser(&parse_handler); 204 buzz::XmlParser parser(&parse_handler);
205 parser.Parse(response_xml.c_str(), response_xml.length(), true); 205 parser.Parse(response_xml.c_str(), response_xml.length(), true);
206 if (!parse_handler.succeeded()) 206 if (!parse_handler.succeeded())
207 return; 207 return;
208 208
209 autofill_metrics::LogServerQueryMetric( 209 metric_logger.Log(AutoFillMetrics::QUERY_RESPONSE_PARSED);
210 autofill_metrics::QUERY_RESPONSE_PARSED);
211 210
212 bool heuristics_detected_fillable_field = false; 211 bool heuristics_detected_fillable_field = false;
213 bool query_response_overrode_heuristics = false; 212 bool query_response_overrode_heuristics = false;
214 213
215 // Copy the field types into the actual form. 214 // Copy the field types into the actual form.
216 std::vector<AutoFillFieldType>::iterator current_type = field_types.begin(); 215 std::vector<AutoFillFieldType>::iterator current_type = field_types.begin();
217 for (std::vector<FormStructure*>::const_iterator iter = forms.begin(); 216 for (std::vector<FormStructure*>::const_iterator iter = forms.begin();
218 iter != forms.end(); ++iter) { 217 iter != forms.end(); ++iter) {
219 FormStructure* form = *iter; 218 FormStructure* form = *iter;
220 219
(...skipping 22 matching lines...) Expand all
243 AutoFillType autofill_type((*field)->type()); 242 AutoFillType autofill_type((*field)->type());
244 if (autofill_type.group() == AutoFillType::CREDIT_CARD) 243 if (autofill_type.group() == AutoFillType::CREDIT_CARD)
245 form->has_credit_card_field_ = true; 244 form->has_credit_card_field_ = true;
246 if (autofill_type.field_type() != UNKNOWN_TYPE) 245 if (autofill_type.field_type() != UNKNOWN_TYPE)
247 form->has_autofillable_field_ = true; 246 form->has_autofillable_field_ = true;
248 } 247 }
249 248
250 form->UpdateAutoFillCount(); 249 form->UpdateAutoFillCount();
251 } 250 }
252 251
253 autofill_metrics::ServerQueryMetricType metric_type; 252 AutoFillMetrics::ServerQueryMetric metric;
254 if (query_response_overrode_heuristics) { 253 if (query_response_overrode_heuristics) {
255 if (heuristics_detected_fillable_field) { 254 if (heuristics_detected_fillable_field) {
256 metric_type = autofill_metrics::QUERY_RESPONSE_OVERRODE_LOCAL_HEURISTICS; 255 metric = AutoFillMetrics::QUERY_RESPONSE_OVERRODE_LOCAL_HEURISTICS;
257 } else { 256 } else {
258 metric_type = autofill_metrics::QUERY_RESPONSE_WITH_NO_LOCAL_HEURISTICS; 257 metric = AutoFillMetrics::QUERY_RESPONSE_WITH_NO_LOCAL_HEURISTICS;
259 } 258 }
260 } else { 259 } else {
261 metric_type = autofill_metrics::QUERY_RESPONSE_MATCHED_LOCAL_HEURISTICS; 260 metric = AutoFillMetrics::QUERY_RESPONSE_MATCHED_LOCAL_HEURISTICS;
262 } 261 }
263 autofill_metrics::LogServerQueryMetric(metric_type); 262 metric_logger.Log(metric);
264 } 263 }
265 264
266 std::string FormStructure::FormSignature() const { 265 std::string FormStructure::FormSignature() const {
267 std::string form_string = target_url_.scheme() + 266 std::string form_string = target_url_.scheme() +
268 "://" + 267 "://" +
269 target_url_.host() + 268 target_url_.host() +
270 "&" + 269 "&" +
271 UTF16ToUTF8(form_name_) + 270 UTF16ToUTF8(form_name_) +
272 form_signature_field_names_; 271 form_signature_field_names_;
273 272
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } else { 424 } else {
426 buzz::XmlElement *field_element = new buzz::XmlElement( 425 buzz::XmlElement *field_element = new buzz::XmlElement(
427 buzz::QName(kXMLElementField)); 426 buzz::QName(kXMLElementField));
428 field_element->SetAttr(buzz::QName(kAttributeSignature), 427 field_element->SetAttr(buzz::QName(kAttributeSignature),
429 field->FieldSignature()); 428 field->FieldSignature());
430 encompassing_xml_element->AddElement(field_element); 429 encompassing_xml_element->AddElement(field_element);
431 } 430 }
432 } 431 }
433 return true; 432 return true;
434 } 433 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/form_structure.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698