| 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 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/autofill/autofill_ecml.h" | 16 #include "chrome/browser/autofill/autofill_ecml.h" |
| 17 #include "chrome/browser/autofill/address_field.h" | 17 #include "chrome/browser/autofill/address_field.h" |
| 18 #include "chrome/browser/autofill/autofill_field.h" | 18 #include "chrome/browser/autofill/autofill_field.h" |
| 19 #include "chrome/browser/autofill/autofill_regexes.h" |
| 19 #include "chrome/browser/autofill/autofill_scanner.h" | 20 #include "chrome/browser/autofill/autofill_scanner.h" |
| 20 #include "chrome/browser/autofill/credit_card_field.h" | 21 #include "chrome/browser/autofill/credit_card_field.h" |
| 21 #include "chrome/browser/autofill/email_field.h" | 22 #include "chrome/browser/autofill/email_field.h" |
| 22 #include "chrome/browser/autofill/field_types.h" | 23 #include "chrome/browser/autofill/field_types.h" |
| 23 #include "chrome/browser/autofill/form_structure.h" | 24 #include "chrome/browser/autofill/form_structure.h" |
| 24 #include "chrome/browser/autofill/name_field.h" | 25 #include "chrome/browser/autofill/name_field.h" |
| 25 #include "chrome/browser/autofill/phone_field.h" | 26 #include "chrome/browser/autofill/phone_field.h" |
| 26 #include "grit/autofill_resources.h" | 27 #include "grit/autofill_resources.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 28 | 29 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 145 } |
| 145 | 146 |
| 146 return false; | 147 return false; |
| 147 } | 148 } |
| 148 | 149 |
| 149 // static | 150 // static |
| 150 bool FormField::Match(const AutofillField* field, | 151 bool FormField::Match(const AutofillField* field, |
| 151 const string16& pattern, | 152 const string16& pattern, |
| 152 int match_type) { | 153 int match_type) { |
| 153 if ((match_type & FormField::MATCH_LABEL) && | 154 if ((match_type & FormField::MATCH_LABEL) && |
| 154 autofill::MatchString(field->label, pattern)) { | 155 autofill::MatchesPattern(field->label, pattern)) { |
| 155 return true; | 156 return true; |
| 156 } | 157 } |
| 157 | 158 |
| 158 if ((match_type & FormField::MATCH_NAME) && | 159 if ((match_type & FormField::MATCH_NAME) && |
| 159 autofill::MatchString(field->name, pattern)) { | 160 autofill::MatchesPattern(field->name, pattern)) { |
| 160 return true; | 161 return true; |
| 161 } | 162 } |
| 162 | 163 |
| 163 return false; | 164 return false; |
| 164 } | 165 } |
| 165 | 166 |
| 166 // static | 167 // static |
| 167 void FormField::ParseFormFieldsPass(ParseFunction parse, | 168 void FormField::ParseFormFieldsPass(ParseFunction parse, |
| 168 bool is_ecml, | 169 bool is_ecml, |
| 169 std::vector<const AutofillField*>* fields, | 170 std::vector<const AutofillField*>* fields, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 180 continue; | 181 continue; |
| 181 } | 182 } |
| 182 | 183 |
| 183 // Add entries into the map for each field type found in |form_field|. | 184 // Add entries into the map for each field type found in |form_field|. |
| 184 bool ok = form_field->ClassifyField(map); | 185 bool ok = form_field->ClassifyField(map); |
| 185 DCHECK(ok); | 186 DCHECK(ok); |
| 186 } | 187 } |
| 187 | 188 |
| 188 std::swap(*fields, remaining_fields); | 189 std::swap(*fields, remaining_fields); |
| 189 } | 190 } |
| OLD | NEW |