| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/autofill/form_field.h" | 5 #include "chrome/browser/autofill/form_field.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // static | 48 // static |
| 49 void FormField::ParseFormFields(const std::vector<AutofillField*>& fields, | 49 void FormField::ParseFormFields(const std::vector<AutofillField*>& fields, |
| 50 FieldTypeMap* map) { | 50 FieldTypeMap* map) { |
| 51 // Set up a working copy of the fields to be processed. | 51 // Set up a working copy of the fields to be processed. |
| 52 std::vector<const AutofillField*> remaining_fields(fields.size()); | 52 std::vector<const AutofillField*> remaining_fields(fields.size()); |
| 53 std::copy(fields.begin(), fields.end(), remaining_fields.begin()); | 53 std::copy(fields.begin(), fields.end(), remaining_fields.begin()); |
| 54 | 54 |
| 55 // Email pass. | 55 // Email pass. |
| 56 ParseFormFieldsPass(EmailField::Parse, &remaining_fields, map); | 56 ParseFormFieldsPass(EmailField::Parse, &remaining_fields, map); |
| 57 | 57 |
| 58 // Phone/fax pass. | 58 // Phone pass. |
| 59 ParseFormFieldsPass(PhoneField::Parse, &remaining_fields, map); | 59 ParseFormFieldsPass(PhoneField::Parse, &remaining_fields, map); |
| 60 | 60 |
| 61 // Address pass. | 61 // Address pass. |
| 62 ParseFormFieldsPass(AddressField::Parse, &remaining_fields, map); | 62 ParseFormFieldsPass(AddressField::Parse, &remaining_fields, map); |
| 63 | 63 |
| 64 // Credit card pass. | 64 // Credit card pass. |
| 65 ParseFormFieldsPass(CreditCardField::Parse, &remaining_fields, map); | 65 ParseFormFieldsPass(CreditCardField::Parse, &remaining_fields, map); |
| 66 | 66 |
| 67 // Name pass. | 67 // Name pass. |
| 68 ParseFormFieldsPass(NameField::Parse, &remaining_fields, map); | 68 ParseFormFieldsPass(NameField::Parse, &remaining_fields, map); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 continue; | 176 continue; |
| 177 } | 177 } |
| 178 | 178 |
| 179 // Add entries into the map for each field type found in |form_field|. | 179 // Add entries into the map for each field type found in |form_field|. |
| 180 bool ok = form_field->ClassifyField(map); | 180 bool ok = form_field->ClassifyField(map); |
| 181 DCHECK(ok); | 181 DCHECK(ok); |
| 182 } | 182 } |
| 183 | 183 |
| 184 std::swap(*fields, remaining_fields); | 184 std::swap(*fields, remaining_fields); |
| 185 } | 185 } |
| OLD | NEW |