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

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

Issue 7063031: Heuristics for grabber-continental.com.out (select-one) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 9 years, 7 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/autofill_resources.grd ('k') | chrome/browser/autofill/email_field.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/credit_card_field.h" 5 #include "chrome/browser/autofill/credit_card_field.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Toolbar Bug 51451: indeed, simply matching "month" is too general for 115 // Toolbar Bug 51451: indeed, simply matching "month" is too general for
116 // https://rps.fidelity.com/ftgw/rps/RtlCust/CreatePIN/Init. 116 // https://rps.fidelity.com/ftgw/rps/RtlCust/CreatePIN/Init.
117 // Instead, we match only words beginning with "month". 117 // Instead, we match only words beginning with "month".
118 if (is_ecml) 118 if (is_ecml)
119 pattern = GetEcmlPattern(kEcmlCardExpireMonth); 119 pattern = GetEcmlPattern(kEcmlCardExpireMonth);
120 else 120 else
121 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_EXPIRATION_MONTH_RE); 121 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_EXPIRATION_MONTH_RE);
122 122
123 if ((!credit_card_field->expiration_month_ || 123 if ((!credit_card_field->expiration_month_ ||
124 credit_card_field->expiration_month_->IsEmpty()) && 124 credit_card_field->expiration_month_->IsEmpty()) &&
125 ParseField(scanner, pattern, &credit_card_field->expiration_month_)) { 125 ParseFieldSpecifics(scanner, pattern, MATCH_DEFAULT | MATCH_SELECT,
126 &credit_card_field->expiration_month_)) {
126 if (is_ecml) 127 if (is_ecml)
127 pattern = GetEcmlPattern(kEcmlCardExpireYear); 128 pattern = GetEcmlPattern(kEcmlCardExpireYear);
128 else 129 else
129 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_EXPIRATION_DATE_RE); 130 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_EXPIRATION_DATE_RE);
130 131
131 if (!ParseField(scanner, pattern, 132 if (!ParseFieldSpecifics(scanner, pattern, MATCH_DEFAULT | MATCH_SELECT,
132 &credit_card_field->expiration_year_)) { 133 &credit_card_field->expiration_year_)) {
133 scanner->Rewind(); 134 scanner->Rewind();
134 return NULL; 135 return NULL;
135 } 136 }
136 continue; 137 continue;
137 } 138 }
138 } 139 }
139 140
140 if (ParseField(scanner, GetEcmlPattern(kEcmlCardExpireDay), NULL)) 141 if (ParseFieldSpecifics(scanner, GetEcmlPattern(kEcmlCardExpireDay),
142 MATCH_DEFAULT | MATCH_SELECT, NULL)) {
141 continue; 143 continue;
144 }
142 145
143 // Some pages (e.g. ExpediaBilling.html) have a "card description" 146 // Some pages (e.g. ExpediaBilling.html) have a "card description"
144 // field; we parse this field but ignore it. 147 // field; we parse this field but ignore it.
145 // We also ignore any other fields within a credit card block that 148 // We also ignore any other fields within a credit card block that
146 // start with "card", under the assumption that they are related to 149 // start with "card", under the assumption that they are related to
147 // the credit card section being processed but are uninteresting to us. 150 // the credit card section being processed but are uninteresting to us.
148 if (ParseField(scanner, 151 if (ParseField(scanner,
149 l10n_util::GetStringUTF16(IDS_AUTOFILL_CARD_IGNORED_RE), 152 l10n_util::GetStringUTF16(IDS_AUTOFILL_CARD_IGNORED_RE),
150 NULL)) { 153 NULL)) {
151 continue; 154 continue;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (cardholder_last_ == NULL) 203 if (cardholder_last_ == NULL)
201 ok = ok && AddClassification(cardholder_, CREDIT_CARD_NAME, map); 204 ok = ok && AddClassification(cardholder_, CREDIT_CARD_NAME, map);
202 205
203 ok = ok && AddClassification(type_, CREDIT_CARD_TYPE, map); 206 ok = ok && AddClassification(type_, CREDIT_CARD_TYPE, map);
204 ok = ok && AddClassification(expiration_month_, CREDIT_CARD_EXP_MONTH, map); 207 ok = ok && AddClassification(expiration_month_, CREDIT_CARD_EXP_MONTH, map);
205 ok = ok && AddClassification(expiration_year_, 208 ok = ok && AddClassification(expiration_year_,
206 CREDIT_CARD_EXP_4_DIGIT_YEAR, 209 CREDIT_CARD_EXP_4_DIGIT_YEAR,
207 map); 210 map);
208 return ok; 211 return ok;
209 } 212 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_resources.grd ('k') | chrome/browser/autofill/email_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698