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

Side by Side Diff: chrome/browser/autofill/phone_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/phone_field.h ('k') | chrome/browser/autofill/phone_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/phone_field.h" 5 #include "chrome/browser/autofill/phone_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/string16.h" 9 #include "base/string16.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Phone: <cc>:3 - <phone>:10 (Ext: <ext>)? 110 // Phone: <cc>:3 - <phone>:10 (Ext: <ext>)?
111 { REGEX_PHONE, FIELD_COUNTRY_CODE, 3 }, 111 { REGEX_PHONE, FIELD_COUNTRY_CODE, 3 },
112 { REGEX_PHONE, FIELD_PHONE, 10 }, 112 { REGEX_PHONE, FIELD_PHONE, 10 },
113 { REGEX_SEPARATOR, FIELD_NONE, 0 }, 113 { REGEX_SEPARATOR, FIELD_NONE, 0 },
114 // Phone: <phone> (Ext: <ext>)? 114 // Phone: <phone> (Ext: <ext>)?
115 { REGEX_PHONE, FIELD_PHONE, 0 }, 115 { REGEX_PHONE, FIELD_PHONE, 0 },
116 { REGEX_SEPARATOR, FIELD_NONE, 0 }, 116 { REGEX_SEPARATOR, FIELD_NONE, 0 },
117 }; 117 };
118 118
119 // static 119 // static
120 FormField* PhoneField::Parse(AutofillScanner* scanner, 120 FormField* PhoneField::Parse(AutofillScanner* scanner) {
121 bool parse_new_field_types) {
122 if (scanner->IsEnd()) 121 if (scanner->IsEnd())
123 return NULL; 122 return NULL;
124 123
125 scanner->SaveCursor(); 124 scanner->SaveCursor();
126 125
127 // The form owns the following variables, so they should not be deleted. 126 // The form owns the following variables, so they should not be deleted.
128 const AutofillField* parsed_fields[FIELD_MAX]; 127 const AutofillField* parsed_fields[FIELD_MAX];
129 128
130 for (size_t i = 0; i < arraysize(kPhoneFieldGrammars); ++i) { 129 for (size_t i = 0; i < arraysize(kPhoneFieldGrammars); ++i) {
131 memset(parsed_fields, 0, sizeof(parsed_fields)); 130 memset(parsed_fields, 0, sizeof(parsed_fields));
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 case REGEX_SUFFIX: 264 case REGEX_SUFFIX:
266 return UTF8ToUTF16(autofill::kPhoneSuffixRe); 265 return UTF8ToUTF16(autofill::kPhoneSuffixRe);
267 case REGEX_EXTENSION: 266 case REGEX_EXTENSION:
268 return UTF8ToUTF16(autofill::kPhoneExtensionRe); 267 return UTF8ToUTF16(autofill::kPhoneExtensionRe);
269 default: 268 default:
270 NOTREACHED(); 269 NOTREACHED();
271 break; 270 break;
272 } 271 }
273 return string16(); 272 return string16();
274 } 273 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/phone_field.h ('k') | chrome/browser/autofill/phone_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698