| 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/autofill_field.h" | 5 #include "components/autofill/core/browser/autofill_field.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/string_search.h" | 10 #include "base/i18n/string_search.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/sha1.h" | 13 #include "base/sha1.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "components/autofill/core/browser/autofill_country.h" | 18 #include "components/autofill/core/browser/autofill_country.h" |
| 19 #include "components/autofill/core/browser/autofill_type.h" | 19 #include "components/autofill/core/browser/autofill_type.h" |
| 20 #include "components/autofill/core/browser/country_names.h" | 20 #include "components/autofill/core/browser/country_names.h" |
| 21 #include "components/autofill/core/browser/credit_card.h" | 21 #include "components/autofill/core/browser/credit_card.h" |
| 22 #include "components/autofill/core/browser/phone_number.h" | 22 #include "components/autofill/core/browser/phone_number.h" |
| 23 #include "components/autofill/core/browser/proto/server.pb.h" |
| 23 #include "components/autofill/core/browser/state_names.h" | 24 #include "components/autofill/core/browser/state_names.h" |
| 24 #include "components/autofill/core/common/autofill_l10n_util.h" | 25 #include "components/autofill/core/common/autofill_l10n_util.h" |
| 25 #include "components/autofill/core/common/autofill_switches.h" | 26 #include "components/autofill/core/common/autofill_switches.h" |
| 26 #include "components/autofill/core/common/autofill_util.h" | 27 #include "components/autofill/core/common/autofill_util.h" |
| 27 #include "grit/components_strings.h" | 28 #include "grit/components_strings.h" |
| 28 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da
ta.h" | 29 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da
ta.h" |
| 29 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fo
rmatter.h" | 30 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fo
rmatter.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 31 | 32 |
| 32 using ::i18n::addressinput::AddressData; | 33 using ::i18n::addressinput::AddressData; |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 437 |
| 437 } // namespace | 438 } // namespace |
| 438 | 439 |
| 439 AutofillField::AutofillField() | 440 AutofillField::AutofillField() |
| 440 : server_type_(NO_SERVER_DATA), | 441 : server_type_(NO_SERVER_DATA), |
| 441 heuristic_type_(UNKNOWN_TYPE), | 442 heuristic_type_(UNKNOWN_TYPE), |
| 442 html_type_(HTML_TYPE_UNSPECIFIED), | 443 html_type_(HTML_TYPE_UNSPECIFIED), |
| 443 html_mode_(HTML_MODE_NONE), | 444 html_mode_(HTML_MODE_NONE), |
| 444 phone_part_(IGNORED), | 445 phone_part_(IGNORED), |
| 445 credit_card_number_offset_(0), | 446 credit_card_number_offset_(0), |
| 446 previously_autofilled_(false) {} | 447 previously_autofilled_(false), |
| 448 generation_type_(AutofillUploadContents::Field::NO_GENERATION) {} |
| 447 | 449 |
| 448 AutofillField::AutofillField(const FormFieldData& field, | 450 AutofillField::AutofillField(const FormFieldData& field, |
| 449 const base::string16& unique_name) | 451 const base::string16& unique_name) |
| 450 : FormFieldData(field), | 452 : FormFieldData(field), |
| 451 unique_name_(unique_name), | 453 unique_name_(unique_name), |
| 452 server_type_(NO_SERVER_DATA), | 454 server_type_(NO_SERVER_DATA), |
| 453 heuristic_type_(UNKNOWN_TYPE), | 455 heuristic_type_(UNKNOWN_TYPE), |
| 454 html_type_(HTML_TYPE_UNSPECIFIED), | 456 html_type_(HTML_TYPE_UNSPECIFIED), |
| 455 html_mode_(HTML_MODE_NONE), | 457 html_mode_(HTML_MODE_NONE), |
| 456 phone_part_(IGNORED), | 458 phone_part_(IGNORED), |
| 457 credit_card_number_offset_(0), | 459 credit_card_number_offset_(0), |
| 458 previously_autofilled_(false), | 460 previously_autofilled_(false), |
| 459 parseable_name_(field.name) {} | 461 parseable_name_(field.name), |
| 462 generation_type_(AutofillUploadContents::Field::NO_GENERATION) {} |
| 460 | 463 |
| 461 AutofillField::~AutofillField() {} | 464 AutofillField::~AutofillField() {} |
| 462 | 465 |
| 463 void AutofillField::set_heuristic_type(ServerFieldType type) { | 466 void AutofillField::set_heuristic_type(ServerFieldType type) { |
| 464 if (type >= 0 && type < MAX_VALID_FIELD_TYPE && | 467 if (type >= 0 && type < MAX_VALID_FIELD_TYPE && |
| 465 type != FIELD_WITH_DEFAULT_VALUE) { | 468 type != FIELD_WITH_DEFAULT_VALUE) { |
| 466 heuristic_type_ = type; | 469 heuristic_type_ = type; |
| 467 } else { | 470 } else { |
| 468 NOTREACHED(); | 471 NOTREACHED(); |
| 469 // This case should not be reachable; but since this has potential | 472 // This case should not be reachable; but since this has potential |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 if (compare.StringsEqual(value_stripped, option_contents)) { | 627 if (compare.StringsEqual(value_stripped, option_contents)) { |
| 625 if (index) | 628 if (index) |
| 626 *index = i; | 629 *index = i; |
| 627 return true; | 630 return true; |
| 628 } | 631 } |
| 629 } | 632 } |
| 630 return false; | 633 return false; |
| 631 } | 634 } |
| 632 | 635 |
| 633 } // namespace autofill | 636 } // namespace autofill |
| OLD | NEW |