| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/i18n/string_compare.h" | 8 #include "base/i18n/string_compare.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 return value.empty(); | 481 return value.empty(); |
| 482 } | 482 } |
| 483 | 483 |
| 484 std::string AutofillField::FieldSignature() const { | 484 std::string AutofillField::FieldSignature() const { |
| 485 std::string field_name = base::UTF16ToUTF8(name); | 485 std::string field_name = base::UTF16ToUTF8(name); |
| 486 std::string field_string = field_name + "&" + form_control_type; | 486 std::string field_string = field_name + "&" + form_control_type; |
| 487 return Hash32Bit(field_string); | 487 return Hash32Bit(field_string); |
| 488 } | 488 } |
| 489 | 489 |
| 490 bool AutofillField::IsFieldFillable() const { | 490 bool AutofillField::IsFieldFillable() const { |
| 491 return (should_autocomplete || | 491 return !Type().IsUnknown(); |
| 492 !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 493 switches::kRespectAutocompleteOffForAutofill)) && | |
| 494 !Type().IsUnknown(); | |
| 495 } | 492 } |
| 496 | 493 |
| 497 // static | 494 // static |
| 498 bool AutofillField::FillFormField(const AutofillField& field, | 495 bool AutofillField::FillFormField(const AutofillField& field, |
| 499 const base::string16& value, | 496 const base::string16& value, |
| 500 const std::string& address_language_code, | 497 const std::string& address_language_code, |
| 501 const std::string& app_locale, | 498 const std::string& app_locale, |
| 502 FormFieldData* field_data) { | 499 FormFieldData* field_data) { |
| 503 AutofillType type = field.Type(); | 500 AutofillType type = field.Type(); |
| 504 | 501 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 collator.get())) { | 567 collator.get())) { |
| 571 if (index) | 568 if (index) |
| 572 *index = i; | 569 *index = i; |
| 573 return true; | 570 return true; |
| 574 } | 571 } |
| 575 } | 572 } |
| 576 return false; | 573 return false; |
| 577 } | 574 } |
| 578 | 575 |
| 579 } // namespace autofill | 576 } // namespace autofill |
| OLD | NEW |