Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/form_structure.h" | 5 #include "components/autofill/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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 autocheckout_url_prefix_(autocheckout_url_prefix) { | 240 autocheckout_url_prefix_(autocheckout_url_prefix) { |
| 241 // Copy the form fields. | 241 // Copy the form fields. |
| 242 std::map<string16, size_t> unique_names; | 242 std::map<string16, size_t> unique_names; |
| 243 for (std::vector<FormFieldData>::const_iterator field = | 243 for (std::vector<FormFieldData>::const_iterator field = |
| 244 form.fields.begin(); | 244 form.fields.begin(); |
| 245 field != form.fields.end(); field++) { | 245 field != form.fields.end(); field++) { |
| 246 | 246 |
| 247 // Skipping checkable elements when Autocheckout is not enabled, else | 247 // Skipping checkable elements when Autocheckout is not enabled, else |
| 248 // these fields will interfere with existing field signatures with Autofill | 248 // these fields will interfere with existing field signatures with Autofill |
| 249 // servers. | 249 // servers. |
| 250 if (!field->is_checkable || IsAutocheckoutEnabled()) { | 250 if ((!field->is_checkable && !field->is_password_field) || |
|
Ilya Sherman
2013/03/15 23:43:27
You should also make sure that password fields do
Raman Kakilate
2013/03/18 17:54:00
Done.
| |
| 251 IsAutocheckoutEnabled()) { | |
| 251 // Add all supported form fields (including with empty names) to the | 252 // Add all supported form fields (including with empty names) to the |
| 252 // signature. This is a requirement for Autofill servers. | 253 // signature. This is a requirement for Autofill servers. |
| 253 form_signature_field_names_.append("&"); | 254 form_signature_field_names_.append("&"); |
| 254 form_signature_field_names_.append(UTF16ToUTF8(field->name)); | 255 form_signature_field_names_.append(UTF16ToUTF8(field->name)); |
| 255 } | 256 } |
| 256 | 257 |
| 257 // Generate a unique name for this field by appending a counter to the name. | 258 // Generate a unique name for this field by appending a counter to the name. |
| 258 // Make sure to prepend the counter with a non-numeric digit so that we are | 259 // Make sure to prepend the counter with a non-numeric digit so that we are |
| 259 // guaranteed to avoid collisions. | 260 // guaranteed to avoid collisions. |
| 260 if (!unique_names.count(field->name)) | 261 if (!unique_names.count(field->name)) |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1148 for (std::vector<AutofillField*>::iterator field = fields_.begin(); | 1149 for (std::vector<AutofillField*>::iterator field = fields_.begin(); |
| 1149 field != fields_.end(); ++field) { | 1150 field != fields_.end(); ++field) { |
| 1150 AutofillType::FieldTypeGroup field_type_group = | 1151 AutofillType::FieldTypeGroup field_type_group = |
| 1151 AutofillType((*field)->type()).group(); | 1152 AutofillType((*field)->type()).group(); |
| 1152 if (field_type_group == AutofillType::CREDIT_CARD) | 1153 if (field_type_group == AutofillType::CREDIT_CARD) |
| 1153 (*field)->set_section((*field)->section() + "-cc"); | 1154 (*field)->set_section((*field)->section() + "-cc"); |
| 1154 else | 1155 else |
| 1155 (*field)->set_section((*field)->section() + "-default"); | 1156 (*field)->set_section((*field)->section() + "-default"); |
| 1156 } | 1157 } |
| 1157 } | 1158 } |
| OLD | NEW |