Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: components/autofill/core/browser/form_structure.cc

Issue 2022123002: Merge autofill::FormFieldData::is_checkable and is_checked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 } 1138 }
1139 } 1139 }
1140 } 1140 }
1141 } 1141 }
1142 1142
1143 void FormStructure::EncodeFormForUpload(AutofillUploadContents* upload) const { 1143 void FormStructure::EncodeFormForUpload(AutofillUploadContents* upload) const {
1144 DCHECK(!IsMalformed()); 1144 DCHECK(!IsMalformed());
1145 1145
1146 for (const AutofillField* field : fields_) { 1146 for (const AutofillField* field : fields_) {
1147 // Don't upload checkable fields. 1147 // Don't upload checkable fields.
1148 if (field->is_checkable) 1148 if (IsCheckable(field->check_status))
1149 continue; 1149 continue;
1150 1150
1151 const ServerFieldTypeSet& types = field->possible_types(); 1151 const ServerFieldTypeSet& types = field->possible_types();
1152 for (const auto& field_type : types) { 1152 for (const auto& field_type : types) {
1153 // Add the same field elements as the query and a few more below. 1153 // Add the same field elements as the query and a few more below.
1154 if (ShouldSkipField(*field)) 1154 if (ShouldSkipField(*field))
1155 continue; 1155 continue;
1156 1156
1157 AutofillUploadContents::Field* added_field = upload->add_field(); 1157 AutofillUploadContents::Field* added_field = upload->add_field();
1158 added_field->set_autofill_type(field_type); 1158 added_field->set_autofill_type(field_type);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 for (AutofillField* field : fields_) { 1303 for (AutofillField* field : fields_) {
1304 FieldTypeGroup field_type_group = field->Type().group(); 1304 FieldTypeGroup field_type_group = field->Type().group();
1305 if (field_type_group == CREDIT_CARD) 1305 if (field_type_group == CREDIT_CARD)
1306 field->set_section(field->section() + "-cc"); 1306 field->set_section(field->section() + "-cc");
1307 else 1307 else
1308 field->set_section(field->section() + "-default"); 1308 field->set_section(field->section() + "-default");
1309 } 1309 }
1310 } 1310 }
1311 1311
1312 bool FormStructure::ShouldSkipField(const FormFieldData& field) const { 1312 bool FormStructure::ShouldSkipField(const FormFieldData& field) const {
1313 return field.is_checkable; 1313 return IsCheckable(field.check_status);
1314 } 1314 }
1315 1315
1316 void FormStructure::ProcessExtractedFields() { 1316 void FormStructure::ProcessExtractedFields() {
1317 // Update the field name parsed by heuristics if several criteria are met. 1317 // Update the field name parsed by heuristics if several criteria are met.
1318 // Several fields must be present in the form. 1318 // Several fields must be present in the form.
1319 if (field_count() < kCommonNamePrefixRemovalFieldThreshold) 1319 if (field_count() < kCommonNamePrefixRemovalFieldThreshold)
1320 return; 1320 return;
1321 1321
1322 // Find the longest common prefix within all the field names. 1322 // Find the longest common prefix within all the field names.
1323 std::vector<base::string16> names; 1323 std::vector<base::string16> names;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 filtered_strings[0].at(prefix_len)) { 1365 filtered_strings[0].at(prefix_len)) {
1366 // Mismatch found. 1366 // Mismatch found.
1367 return filtered_strings[i].substr(0, prefix_len); 1367 return filtered_strings[i].substr(0, prefix_len);
1368 } 1368 }
1369 } 1369 }
1370 } 1370 }
1371 return filtered_strings[0]; 1371 return filtered_strings[0];
1372 } 1372 }
1373 1373
1374 } // namespace autofill 1374 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/form_field_unittest.cc ('k') | components/autofill/core/browser/form_structure_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698