| 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 *found_sections = true; | 1143 *found_sections = true; |
| 1144 field->set_section(section); | 1144 field->set_section(section); |
| 1145 } | 1145 } |
| 1146 | 1146 |
| 1147 // No errors encountered while parsing! | 1147 // No errors encountered while parsing! |
| 1148 // Update the |field|'s type based on what was parsed from the attribute. | 1148 // Update the |field|'s type based on what was parsed from the attribute. |
| 1149 field->SetHtmlType(field_type, mode); | 1149 field->SetHtmlType(field_type, mode); |
| 1150 } | 1150 } |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 bool FormStructure::FillFields( |
| 1154 const std::vector<ServerFieldType>& types, |
| 1155 const InputFieldComparator& matches, |
| 1156 const base::Callback<base::string16(const AutofillType&)>& get_info, |
| 1157 const std::string& app_locale) { |
| 1158 bool filled_something = false; |
| 1159 for (size_t i = 0; i < field_count(); ++i) { |
| 1160 for (size_t j = 0; j < types.size(); ++j) { |
| 1161 if (matches.Run(types[j], *field(i))) { |
| 1162 AutofillField::FillFormField(*field(i), |
| 1163 get_info.Run(field(i)->Type()), |
| 1164 app_locale, |
| 1165 field(i)); |
| 1166 filled_something = true; |
| 1167 break; |
| 1168 } |
| 1169 } |
| 1170 } |
| 1171 return filled_something; |
| 1172 } |
| 1173 |
| 1153 void FormStructure::IdentifySections(bool has_author_specified_sections) { | 1174 void FormStructure::IdentifySections(bool has_author_specified_sections) { |
| 1154 if (fields_.empty()) | 1175 if (fields_.empty()) |
| 1155 return; | 1176 return; |
| 1156 | 1177 |
| 1157 if (!has_author_specified_sections) { | 1178 if (!has_author_specified_sections) { |
| 1158 // Name sections after the first field in the section. | 1179 // Name sections after the first field in the section. |
| 1159 base::string16 current_section = fields_.front()->unique_name(); | 1180 base::string16 current_section = fields_.front()->unique_name(); |
| 1160 | 1181 |
| 1161 // Keep track of the types we've seen in this section. | 1182 // Keep track of the types we've seen in this section. |
| 1162 std::set<ServerFieldType> seen_types; | 1183 std::set<ServerFieldType> seen_types; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 field != fields_.end(); ++field) { | 1226 field != fields_.end(); ++field) { |
| 1206 FieldTypeGroup field_type_group = (*field)->Type().group(); | 1227 FieldTypeGroup field_type_group = (*field)->Type().group(); |
| 1207 if (field_type_group == CREDIT_CARD) | 1228 if (field_type_group == CREDIT_CARD) |
| 1208 (*field)->set_section((*field)->section() + "-cc"); | 1229 (*field)->set_section((*field)->section() + "-cc"); |
| 1209 else | 1230 else |
| 1210 (*field)->set_section((*field)->section() + "-default"); | 1231 (*field)->set_section((*field)->section() + "-default"); |
| 1211 } | 1232 } |
| 1212 } | 1233 } |
| 1213 | 1234 |
| 1214 } // namespace autofill | 1235 } // namespace autofill |
| OLD | NEW |