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

Side by Side Diff: chrome/browser/autofill/name_field.cc

Issue 7545003: Add ignore matching text for name field. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add ignore matching text in name field. Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
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/name_field.h" 5 #include "chrome/browser/autofill/name_field.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // dell_checkout1.html). At least one UK page (The China Shop2.html) 143 // dell_checkout1.html). At least one UK page (The China Shop2.html)
144 // asks, in stuffy English style, for just initials and a surname, 144 // asks, in stuffy English style, for just initials and a surname,
145 // so we match "initials" here (and just fill in a first name there, 145 // so we match "initials" here (and just fill in a first name there,
146 // American-style). 146 // American-style).
147 // The ".*first$" matches fields ending in "first" (example in sample8.html). 147 // The ".*first$" matches fields ending in "first" (example in sample8.html).
148 // The ".*last$" matches fields ending in "last" (example in sample8.html). 148 // The ".*last$" matches fields ending in "last" (example in sample8.html).
149 149
150 // Allow name fields to appear in any order. 150 // Allow name fields to appear in any order.
151 while (!scanner->IsEnd()) { 151 while (!scanner->IsEnd()) {
152 // Skip over any unrelated fields, e.g. "username" or "nickname". 152 // Skip over any unrelated fields, e.g. "username" or "nickname".
153 if (ParseField(scanner, 153 if (ParseFieldSpecifics(scanner,
154 l10n_util::GetStringUTF16(IDS_AUTOFILL_NAME_IGNORED_RE), 154 l10n_util::GetStringUTF16(IDS_AUTOFILL_NAME_IGNORED_RE),
155 NULL)) { 155 MATCH_DEFAULT | MATCH_SELECT, NULL)) {
Ilya Sherman 2011/08/03 07:27:26 nit: Please either indent to the parenthesis or by
156 continue; 156 continue;
157 } 157 }
158 158
159 if (!v->first_name_ && 159 if (!v->first_name_ &&
160 ParseField(scanner, 160 ParseField(scanner,
161 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIRST_NAME_RE), 161 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIRST_NAME_RE),
162 &v->first_name_)) { 162 &v->first_name_)) {
163 continue; 163 continue;
164 } 164 }
165 165
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 middle_initial_(false) { 241 middle_initial_(false) {
242 } 242 }
243 243
244 bool FirstLastNameField::ClassifyField(FieldTypeMap* map) const { 244 bool FirstLastNameField::ClassifyField(FieldTypeMap* map) const {
245 bool ok = AddClassification(first_name_, NAME_FIRST, map); 245 bool ok = AddClassification(first_name_, NAME_FIRST, map);
246 ok = ok && AddClassification(last_name_, NAME_LAST, map); 246 ok = ok && AddClassification(last_name_, NAME_LAST, map);
247 AutofillFieldType type = middle_initial_ ? NAME_MIDDLE_INITIAL : NAME_MIDDLE; 247 AutofillFieldType type = middle_initial_ ? NAME_MIDDLE_INITIAL : NAME_MIDDLE;
248 ok = ok && AddClassification(middle_name_, type, map); 248 ok = ok && AddClassification(middle_name_, type, map);
249 return ok; 249 return ok;
250 } 250 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698