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

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

Issue 12260054: [Autofill] Enable heuristic detection of credit card issuer fields. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 10 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
« no previous file with comments | « chrome/browser/autofill/name_field.h ('k') | chrome/browser/autofill/name_field_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 const AutofillField* first_name_; 49 const AutofillField* first_name_;
50 const AutofillField* middle_name_; // Optional. 50 const AutofillField* middle_name_; // Optional.
51 const AutofillField* last_name_; 51 const AutofillField* last_name_;
52 bool middle_initial_; // True if middle_name_ is a middle initial. 52 bool middle_initial_; // True if middle_name_ is a middle initial.
53 53
54 DISALLOW_COPY_AND_ASSIGN(FirstLastNameField); 54 DISALLOW_COPY_AND_ASSIGN(FirstLastNameField);
55 }; 55 };
56 56
57 } // namespace 57 } // namespace
58 58
59 FormField* NameField::Parse(AutofillScanner* scanner, 59 FormField* NameField::Parse(AutofillScanner* scanner) {
60 bool parse_new_field_types) {
61 if (scanner->IsEnd()) 60 if (scanner->IsEnd())
62 return NULL; 61 return NULL;
63 62
64 // Try FirstLastNameField first since it's more specific. 63 // Try FirstLastNameField first since it's more specific.
65 NameField* field = FirstLastNameField::Parse(scanner); 64 NameField* field = FirstLastNameField::Parse(scanner);
66 if (!field) 65 if (!field)
67 field = FullNameField::Parse(scanner); 66 field = FullNameField::Parse(scanner);
68 return field; 67 return field;
69 } 68 }
70 69
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 middle_initial_(false) { 205 middle_initial_(false) {
207 } 206 }
208 207
209 bool FirstLastNameField::ClassifyField(FieldTypeMap* map) const { 208 bool FirstLastNameField::ClassifyField(FieldTypeMap* map) const {
210 bool ok = AddClassification(first_name_, NAME_FIRST, map); 209 bool ok = AddClassification(first_name_, NAME_FIRST, map);
211 ok = ok && AddClassification(last_name_, NAME_LAST, map); 210 ok = ok && AddClassification(last_name_, NAME_LAST, map);
212 AutofillFieldType type = middle_initial_ ? NAME_MIDDLE_INITIAL : NAME_MIDDLE; 211 AutofillFieldType type = middle_initial_ ? NAME_MIDDLE_INITIAL : NAME_MIDDLE;
213 ok = ok && AddClassification(middle_name_, type, map); 212 ok = ok && AddClassification(middle_name_, type, map);
214 return ok; 213 return ok;
215 } 214 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/name_field.h ('k') | chrome/browser/autofill/name_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698