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

Unified Diff: components/autofill/core/browser/form_structure.cc

Issue 1104543006: Style cleanups in Autofill for greater code clarity. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/browser/credit_card.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/form_structure.cc
diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc
index 5c76c62b02986b4159c7e050ef733b063d834653..5387952e8fc534a93d755ed104627b6e885624d4 100644
--- a/components/autofill/core/browser/form_structure.cc
+++ b/components/autofill/core/browser/form_structure.cc
@@ -363,31 +363,26 @@ FormStructure::FormStructure(const FormData& form)
is_form_tag_(form.is_form_tag) {
// Copy the form fields.
std::map<base::string16, size_t> unique_names;
- for (std::vector<FormFieldData>::const_iterator field =
- form.fields.begin();
- field != form.fields.end(); ++field) {
- if (!ShouldSkipField(*field)) {
+ for (const FormFieldData& field : form.fields) {
+ if (!ShouldSkipField(field)) {
// Add all supported form fields (including with empty names) to the
// signature. This is a requirement for Autofill servers.
form_signature_field_names_.append("&");
- form_signature_field_names_.append(StripDigitsIfRequired(field->name));
+ form_signature_field_names_.append(StripDigitsIfRequired(field.name));
++active_field_count_;
}
- if (field->form_control_type == "password")
+ if (field.form_control_type == "password")
has_password_field_ = true;
// Generate a unique name for this field by appending a counter to the name.
// Make sure to prepend the counter with a non-numeric digit so that we are
// guaranteed to avoid collisions.
- if (!unique_names.count(field->name))
- unique_names[field->name] = 1;
- else
- ++unique_names[field->name];
- base::string16 unique_name = field->name + base::ASCIIToUTF16("_") +
- base::IntToString16(unique_names[field->name]);
- fields_.push_back(new AutofillField(*field, unique_name));
+ base::string16 unique_name =
+ field.name + base::ASCIIToUTF16("_") +
+ base::IntToString16(++unique_names[field.name]);
+ fields_.push_back(new AutofillField(field, unique_name));
}
}
« no previous file with comments | « components/autofill/core/browser/credit_card.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698