| 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 15 matching lines...) Expand all Loading... |
| 26 #include "components/autofill/core/browser/field_candidates.h" | 26 #include "components/autofill/core/browser/field_candidates.h" |
| 27 #include "components/autofill/core/browser/field_types.h" | 27 #include "components/autofill/core/browser/field_types.h" |
| 28 #include "components/autofill/core/browser/form_field.h" | 28 #include "components/autofill/core/browser/form_field.h" |
| 29 #include "components/autofill/core/common/autofill_constants.h" | 29 #include "components/autofill/core/common/autofill_constants.h" |
| 30 #include "components/autofill/core/common/autofill_util.h" | 30 #include "components/autofill/core/common/autofill_util.h" |
| 31 #include "components/autofill/core/common/form_data.h" | 31 #include "components/autofill/core/common/form_data.h" |
| 32 #include "components/autofill/core/common/form_data_predictions.h" | 32 #include "components/autofill/core/common/form_data_predictions.h" |
| 33 #include "components/autofill/core/common/form_field_data.h" | 33 #include "components/autofill/core/common/form_field_data.h" |
| 34 #include "components/autofill/core/common/form_field_data_predictions.h" | 34 #include "components/autofill/core/common/form_field_data_predictions.h" |
| 35 #include "components/autofill/core/common/signatures_util.h" | 35 #include "components/autofill/core/common/signatures_util.h" |
| 36 #include "components/rappor/rappor_service.h" | 36 #include "components/rappor/public/rappor_utils.h" |
| 37 #include "components/rappor/rappor_utils.h" | 37 #include "components/rappor/rappor_service_impl.h" |
| 38 | 38 |
| 39 namespace autofill { | 39 namespace autofill { |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 const char kClientVersion[] = "6.1.1715.1442/en (GGLL)"; | 42 const char kClientVersion[] = "6.1.1715.1442/en (GGLL)"; |
| 43 const char kBillingMode[] = "billing"; | 43 const char kBillingMode[] = "billing"; |
| 44 const char kShippingMode[] = "shipping"; | 44 const char kShippingMode[] = "shipping"; |
| 45 | 45 |
| 46 // A form is considered to have a high prediction mismatch rate if the number of | 46 // A form is considered to have a high prediction mismatch rate if the number of |
| 47 // mismatches exceeds this threshold. | 47 // mismatches exceeds this threshold. |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 435 |
| 436 form->EncodeFormForQuery(query->add_form()); | 436 form->EncodeFormForQuery(query->add_form()); |
| 437 | 437 |
| 438 encoded_signatures->push_back(signature); | 438 encoded_signatures->push_back(signature); |
| 439 } | 439 } |
| 440 | 440 |
| 441 return !encoded_signatures->empty(); | 441 return !encoded_signatures->empty(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 // static | 444 // static |
| 445 void FormStructure::ParseQueryResponse(std::string payload, | 445 void FormStructure::ParseQueryResponse( |
| 446 const std::vector<FormStructure*>& forms, | 446 std::string payload, |
| 447 rappor::RapporService* rappor_service) { | 447 const std::vector<FormStructure*>& forms, |
| 448 rappor::RapporServiceImpl* rappor_service) { |
| 448 AutofillMetrics::LogServerQueryMetric( | 449 AutofillMetrics::LogServerQueryMetric( |
| 449 AutofillMetrics::QUERY_RESPONSE_RECEIVED); | 450 AutofillMetrics::QUERY_RESPONSE_RECEIVED); |
| 450 | 451 |
| 451 // Parse the response. | 452 // Parse the response. |
| 452 AutofillQueryResponseContents response; | 453 AutofillQueryResponseContents response; |
| 453 if (!response.ParseFromString(payload)) | 454 if (!response.ParseFromString(payload)) |
| 454 return; | 455 return; |
| 455 | 456 |
| 456 VLOG(1) << "Autofill query response was successfully parsed:\n" << response; | 457 VLOG(1) << "Autofill query response was successfully parsed:\n" << response; |
| 457 | 458 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 // request. | 663 // request. |
| 663 DCHECK_EQ(cached_form.form_name_, form_name_); | 664 DCHECK_EQ(cached_form.form_name_, form_name_); |
| 664 DCHECK_EQ(cached_form.source_url_, source_url_); | 665 DCHECK_EQ(cached_form.source_url_, source_url_); |
| 665 DCHECK_EQ(cached_form.target_url_, target_url_); | 666 DCHECK_EQ(cached_form.target_url_, target_url_); |
| 666 form_signature_ = cached_form.form_signature_; | 667 form_signature_ = cached_form.form_signature_; |
| 667 } | 668 } |
| 668 | 669 |
| 669 void FormStructure::LogQualityMetrics(const base::TimeTicks& load_time, | 670 void FormStructure::LogQualityMetrics(const base::TimeTicks& load_time, |
| 670 const base::TimeTicks& interaction_time, | 671 const base::TimeTicks& interaction_time, |
| 671 const base::TimeTicks& submission_time, | 672 const base::TimeTicks& submission_time, |
| 672 rappor::RapporService* rappor_service, | 673 rappor::RapporServiceImpl* rappor_service, |
| 673 bool did_show_suggestions, | 674 bool did_show_suggestions, |
| 674 bool observed_submission) const { | 675 bool observed_submission) const { |
| 675 size_t num_detected_field_types = 0; | 676 size_t num_detected_field_types = 0; |
| 676 size_t num_server_mismatches = 0; | 677 size_t num_server_mismatches = 0; |
| 677 size_t num_heuristic_mismatches = 0; | 678 size_t num_heuristic_mismatches = 0; |
| 678 size_t num_edited_autofilled_fields = 0; | 679 size_t num_edited_autofilled_fields = 0; |
| 679 bool did_autofill_all_possible_fields = true; | 680 bool did_autofill_all_possible_fields = true; |
| 680 bool did_autofill_some_possible_fields = false; | 681 bool did_autofill_some_possible_fields = false; |
| 681 for (size_t i = 0; i < field_count(); ++i) { | 682 for (size_t i = 0; i < field_count(); ++i) { |
| 682 const AutofillField* field = this->field(i); | 683 const AutofillField* field = this->field(i); |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 filtered_strings[0].at(prefix_len)) { | 1316 filtered_strings[0].at(prefix_len)) { |
| 1316 // Mismatch found. | 1317 // Mismatch found. |
| 1317 return filtered_strings[i].substr(0, prefix_len); | 1318 return filtered_strings[i].substr(0, prefix_len); |
| 1318 } | 1319 } |
| 1319 } | 1320 } |
| 1320 } | 1321 } |
| 1321 return filtered_strings[0]; | 1322 return filtered_strings[0]; |
| 1322 } | 1323 } |
| 1323 | 1324 |
| 1324 } // namespace autofill | 1325 } // namespace autofill |
| OLD | NEW |