| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 #include "components/autofill/core/browser/validation.h" | 31 #include "components/autofill/core/browser/validation.h" |
| 32 #include "components/autofill/core/common/autofill_constants.h" | 32 #include "components/autofill/core/common/autofill_constants.h" |
| 33 #include "components/autofill/core/common/autofill_util.h" | 33 #include "components/autofill/core/common/autofill_util.h" |
| 34 #include "components/autofill/core/common/form_data.h" | 34 #include "components/autofill/core/common/form_data.h" |
| 35 #include "components/autofill/core/common/form_data_predictions.h" | 35 #include "components/autofill/core/common/form_data_predictions.h" |
| 36 #include "components/autofill/core/common/form_field_data.h" | 36 #include "components/autofill/core/common/form_field_data.h" |
| 37 #include "components/autofill/core/common/form_field_data_predictions.h" | 37 #include "components/autofill/core/common/form_field_data_predictions.h" |
| 38 #include "components/autofill/core/common/signatures_util.h" | 38 #include "components/autofill/core/common/signatures_util.h" |
| 39 #include "components/rappor/public/rappor_utils.h" | 39 #include "components/rappor/public/rappor_utils.h" |
| 40 #include "components/rappor/rappor_service_impl.h" | 40 #include "components/rappor/rappor_service_impl.h" |
| 41 #include "components/ukm/ukm_service.h" | 41 #include "components/ukm/public/ukm_recorder.h" |
| 42 | 42 |
| 43 namespace autofill { | 43 namespace autofill { |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 const char kClientVersion[] = "6.1.1715.1442/en (GGLL)"; | 46 const char kClientVersion[] = "6.1.1715.1442/en (GGLL)"; |
| 47 const char kBillingMode[] = "billing"; | 47 const char kBillingMode[] = "billing"; |
| 48 const char kShippingMode[] = "shipping"; | 48 const char kShippingMode[] = "shipping"; |
| 49 | 49 |
| 50 // A form is considered to have a high prediction mismatch rate if the number of | 50 // A form is considered to have a high prediction mismatch rate if the number of |
| 51 // mismatches exceeds this threshold. | 51 // mismatches exceeds this threshold. |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 fields_.push_back(base::MakeUnique<AutofillField>(field, unique_name)); | 346 fields_.push_back(base::MakeUnique<AutofillField>(field, unique_name)); |
| 347 } | 347 } |
| 348 | 348 |
| 349 form_signature_ = autofill::CalculateFormSignature(form); | 349 form_signature_ = autofill::CalculateFormSignature(form); |
| 350 // Do further processing on the fields, as needed. | 350 // Do further processing on the fields, as needed. |
| 351 ProcessExtractedFields(); | 351 ProcessExtractedFields(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 FormStructure::~FormStructure() {} | 354 FormStructure::~FormStructure() {} |
| 355 | 355 |
| 356 void FormStructure::DetermineHeuristicTypes(ukm::UkmService* ukm_service) { | 356 void FormStructure::DetermineHeuristicTypes(ukm::UkmRecorder* ukm_recorder) { |
| 357 const auto determine_heuristic_types_start_time = base::TimeTicks::Now(); | 357 const auto determine_heuristic_types_start_time = base::TimeTicks::Now(); |
| 358 | 358 |
| 359 // First, try to detect field types based on each field's |autocomplete| | 359 // First, try to detect field types based on each field's |autocomplete| |
| 360 // attribute value. | 360 // attribute value. |
| 361 if (!was_parsed_for_autocomplete_attributes_) | 361 if (!was_parsed_for_autocomplete_attributes_) |
| 362 ParseFieldTypesFromAutocompleteAttributes(); | 362 ParseFieldTypesFromAutocompleteAttributes(); |
| 363 | 363 |
| 364 // Then if there are enough active fields, and if we are dealing with either a | 364 // Then if there are enough active fields, and if we are dealing with either a |
| 365 // proper <form> or a <form>-less checkout, run the heuristics and server | 365 // proper <form> or a <form>-less checkout, run the heuristics and server |
| 366 // prediction routines. | 366 // prediction routines. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 389 } | 389 } |
| 390 | 390 |
| 391 if (has_author_specified_upi_vpa_hint_) { | 391 if (has_author_specified_upi_vpa_hint_) { |
| 392 AutofillMetrics::LogDeveloperEngagementMetric( | 392 AutofillMetrics::LogDeveloperEngagementMetric( |
| 393 AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT); | 393 AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT); |
| 394 developer_engagement_metrics |= | 394 developer_engagement_metrics |= |
| 395 1 << AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT; | 395 1 << AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT; |
| 396 } | 396 } |
| 397 | 397 |
| 398 if (developer_engagement_metrics) | 398 if (developer_engagement_metrics) |
| 399 AutofillMetrics::LogDeveloperEngagementUkm(ukm_service, source_url(), | 399 AutofillMetrics::LogDeveloperEngagementUkm(ukm_recorder, source_url(), |
| 400 developer_engagement_metrics); | 400 developer_engagement_metrics); |
| 401 | 401 |
| 402 AutofillMetrics::LogDetermineHeuristicTypesTiming( | 402 AutofillMetrics::LogDetermineHeuristicTypesTiming( |
| 403 base::TimeTicks::Now() - determine_heuristic_types_start_time); | 403 base::TimeTicks::Now() - determine_heuristic_types_start_time); |
| 404 } | 404 } |
| 405 | 405 |
| 406 bool FormStructure::EncodeUploadRequest( | 406 bool FormStructure::EncodeUploadRequest( |
| 407 const ServerFieldTypeSet& available_field_types, | 407 const ServerFieldTypeSet& available_field_types, |
| 408 bool form_was_autofilled, | 408 bool form_was_autofilled, |
| 409 const std::string& login_form_signature, | 409 const std::string& login_form_signature, |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 filtered_strings[0].at(prefix_len)) { | 1383 filtered_strings[0].at(prefix_len)) { |
| 1384 // Mismatch found. | 1384 // Mismatch found. |
| 1385 return filtered_strings[i].substr(0, prefix_len); | 1385 return filtered_strings[i].substr(0, prefix_len); |
| 1386 } | 1386 } |
| 1387 } | 1387 } |
| 1388 } | 1388 } |
| 1389 return filtered_strings[0]; | 1389 return filtered_strings[0]; |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 } // namespace autofill | 1392 } // namespace autofill |
| OLD | NEW |