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

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

Issue 2776223002: Adds UKM for autofill attributes in form_structure. (Closed)
Patch Set: Updates tests to account for multiple metrics for same source_url(). Created 3 years, 9 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/form_structure.h" 5 #include "components/autofill/core/browser/form_structure.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 18 matching lines...) Expand all
29 #include "components/autofill/core/browser/form_field.h" 29 #include "components/autofill/core/browser/form_field.h"
30 #include "components/autofill/core/common/autofill_constants.h" 30 #include "components/autofill/core/common/autofill_constants.h"
31 #include "components/autofill/core/common/autofill_util.h" 31 #include "components/autofill/core/common/autofill_util.h"
32 #include "components/autofill/core/common/form_data.h" 32 #include "components/autofill/core/common/form_data.h"
33 #include "components/autofill/core/common/form_data_predictions.h" 33 #include "components/autofill/core/common/form_data_predictions.h"
34 #include "components/autofill/core/common/form_field_data.h" 34 #include "components/autofill/core/common/form_field_data.h"
35 #include "components/autofill/core/common/form_field_data_predictions.h" 35 #include "components/autofill/core/common/form_field_data_predictions.h"
36 #include "components/autofill/core/common/signatures_util.h" 36 #include "components/autofill/core/common/signatures_util.h"
37 #include "components/rappor/public/rappor_utils.h" 37 #include "components/rappor/public/rappor_utils.h"
38 #include "components/rappor/rappor_service_impl.h" 38 #include "components/rappor/rappor_service_impl.h"
39 #include "components/ukm/ukm_service.h"
39 40
40 namespace autofill { 41 namespace autofill {
41 namespace { 42 namespace {
42 43
43 const char kClientVersion[] = "6.1.1715.1442/en (GGLL)"; 44 const char kClientVersion[] = "6.1.1715.1442/en (GGLL)";
44 const char kBillingMode[] = "billing"; 45 const char kBillingMode[] = "billing";
45 const char kShippingMode[] = "shipping"; 46 const char kShippingMode[] = "shipping";
46 47
47 // A form is considered to have a high prediction mismatch rate if the number of 48 // A form is considered to have a high prediction mismatch rate if the number of
48 // mismatches exceeds this threshold. 49 // mismatches exceeds this threshold.
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 fields_.push_back(base::MakeUnique<AutofillField>(field, unique_name)); 326 fields_.push_back(base::MakeUnique<AutofillField>(field, unique_name));
326 } 327 }
327 328
328 form_signature_ = autofill::CalculateFormSignature(form); 329 form_signature_ = autofill::CalculateFormSignature(form);
329 // Do further processing on the fields, as needed. 330 // Do further processing on the fields, as needed.
330 ProcessExtractedFields(); 331 ProcessExtractedFields();
331 } 332 }
332 333
333 FormStructure::~FormStructure() {} 334 FormStructure::~FormStructure() {}
334 335
335 void FormStructure::DetermineHeuristicTypes() { 336 void FormStructure::DetermineHeuristicTypes(ukm::UkmService* ukm_service) {
336 const auto determine_heuristic_types_start_time = base::TimeTicks::Now(); 337 const auto determine_heuristic_types_start_time = base::TimeTicks::Now();
337 338
338 // First, try to detect field types based on each field's |autocomplete| 339 // First, try to detect field types based on each field's |autocomplete|
339 // attribute value. 340 // attribute value.
340 if (!was_parsed_for_autocomplete_attributes_) 341 if (!was_parsed_for_autocomplete_attributes_)
341 ParseFieldTypesFromAutocompleteAttributes(); 342 ParseFieldTypesFromAutocompleteAttributes();
342 343
343 // Then if there are enough active fields, and if we are dealing with either a 344 // Then if there are enough active fields, and if we are dealing with either a
344 // proper <form> or a <form>-less checkout, run the heuristics and server 345 // proper <form> or a <form>-less checkout, run the heuristics and server
345 // prediction routines. 346 // prediction routines.
(...skipping 10 matching lines...) Expand all
356 357
357 UpdateAutofillCount(); 358 UpdateAutofillCount();
358 IdentifySections(has_author_specified_sections_); 359 IdentifySections(has_author_specified_sections_);
359 360
360 if (IsAutofillable()) { 361 if (IsAutofillable()) {
361 AutofillMetrics::LogDeveloperEngagementMetric( 362 AutofillMetrics::LogDeveloperEngagementMetric(
362 AutofillMetrics::FILLABLE_FORM_PARSED); 363 AutofillMetrics::FILLABLE_FORM_PARSED);
363 if (has_author_specified_types_) { 364 if (has_author_specified_types_) {
364 AutofillMetrics::LogDeveloperEngagementMetric( 365 AutofillMetrics::LogDeveloperEngagementMetric(
365 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS); 366 AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS);
367 AutofillMetrics::LogDeveloperEngagementUkm(
368 ukm_service, source_url(),
369 {AutofillMetrics::FILLABLE_FORM_CONTAINS_TYPE_HINTS,
sebsg 2017/03/29 13:52:58 by looking at the comments of these constants, it
csashi 2017/03/29 16:15:11 Yes, CONTAINS_TYPE_HINTS are a subset of FORM_PARS
sebsg 2017/03/29 17:55:13 I see, I really prefer logging only once if it's a
sebsg 2017/03/29 18:46:09 Ok I talked with Math. Would you mind renaming the
csashi 2017/03/30 00:52:10 Done.
370 AutofillMetrics::FILLABLE_FORM_PARSED});
371 } else {
372 AutofillMetrics::LogDeveloperEngagementUkm(
373 ukm_service, source_url(), {AutofillMetrics::FILLABLE_FORM_PARSED});
366 } 374 }
367 } 375 }
368 376
369 AutofillMetrics::LogDetermineHeuristicTypesTiming( 377 AutofillMetrics::LogDetermineHeuristicTypesTiming(
370 base::TimeTicks::Now() - determine_heuristic_types_start_time); 378 base::TimeTicks::Now() - determine_heuristic_types_start_time);
371 } 379 }
372 380
373 bool FormStructure::EncodeUploadRequest( 381 bool FormStructure::EncodeUploadRequest(
374 const ServerFieldTypeSet& available_field_types, 382 const ServerFieldTypeSet& available_field_types,
375 bool form_was_autofilled, 383 bool form_was_autofilled,
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 filtered_strings[0].at(prefix_len)) { 1327 filtered_strings[0].at(prefix_len)) {
1320 // Mismatch found. 1328 // Mismatch found.
1321 return filtered_strings[i].substr(0, prefix_len); 1329 return filtered_strings[i].substr(0, prefix_len);
1322 } 1330 }
1323 } 1331 }
1324 } 1332 }
1325 return filtered_strings[0]; 1333 return filtered_strings[0];
1326 } 1334 }
1327 1335
1328 } // namespace autofill 1336 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/form_structure.h ('k') | components/autofill/core/browser/form_structure_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698