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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 // before any validation so that fields with invalid attributes still end up | 1010 // before any validation so that fields with invalid attributes still end up |
1011 // in the default section. These default section names will be overridden | 1011 // in the default section. These default section names will be overridden |
1012 // by subsequent heuristic parsing steps if there are no author-specified | 1012 // by subsequent heuristic parsing steps if there are no author-specified |
1013 // section names. | 1013 // section names. |
1014 field->set_section(kDefaultSection); | 1014 field->set_section(kDefaultSection); |
1015 | 1015 |
1016 // Canonicalize the attribute value by trimming whitespace, collapsing | 1016 // Canonicalize the attribute value by trimming whitespace, collapsing |
1017 // non-space characters (e.g. tab) to spaces, and converting to lowercase. | 1017 // non-space characters (e.g. tab) to spaces, and converting to lowercase. |
1018 std::string autocomplete_attribute = | 1018 std::string autocomplete_attribute = |
1019 base::CollapseWhitespaceASCII(field->autocomplete_attribute, false); | 1019 base::CollapseWhitespaceASCII(field->autocomplete_attribute, false); |
1020 autocomplete_attribute = StringToLowerASCII(autocomplete_attribute); | 1020 autocomplete_attribute = base::StringToLowerASCII(autocomplete_attribute); |
1021 | 1021 |
1022 // The autocomplete attribute is overloaded: it can specify either a field | 1022 // The autocomplete attribute is overloaded: it can specify either a field |
1023 // type hint or whether autocomplete should be enabled at all. Ignore the | 1023 // type hint or whether autocomplete should be enabled at all. Ignore the |
1024 // latter type of attribute value. | 1024 // latter type of attribute value. |
1025 if (autocomplete_attribute.empty() || | 1025 if (autocomplete_attribute.empty() || |
1026 autocomplete_attribute == "on" || | 1026 autocomplete_attribute == "on" || |
1027 autocomplete_attribute == "off") { | 1027 autocomplete_attribute == "off") { |
1028 continue; | 1028 continue; |
1029 } | 1029 } |
1030 | 1030 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 field != fields_.end(); ++field) { | 1228 field != fields_.end(); ++field) { |
1229 FieldTypeGroup field_type_group = (*field)->Type().group(); | 1229 FieldTypeGroup field_type_group = (*field)->Type().group(); |
1230 if (field_type_group == CREDIT_CARD) | 1230 if (field_type_group == CREDIT_CARD) |
1231 (*field)->set_section((*field)->section() + "-cc"); | 1231 (*field)->set_section((*field)->section() + "-cc"); |
1232 else | 1232 else |
1233 (*field)->set_section((*field)->section() + "-default"); | 1233 (*field)->set_section((*field)->section() + "-default"); |
1234 } | 1234 } |
1235 } | 1235 } |
1236 | 1236 |
1237 } // namespace autofill | 1237 } // namespace autofill |
OLD | NEW |