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

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

Issue 6633001: Convert autofill messages to use the new IPC macros (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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/credit_card_field.h" 5 #include "chrome/browser/autofill/credit_card_field.h"
6 6
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/autofill/autofill_field.h" 10 #include "chrome/browser/autofill/autofill_field.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 if (is_ecml) 112 if (is_ecml)
113 pattern = GetEcmlPattern(kEcmlCardNumber); 113 pattern = GetEcmlPattern(kEcmlCardNumber);
114 else 114 else
115 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_CARD_NUMBER_RE); 115 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_CARD_NUMBER_RE);
116 116
117 if (credit_card_field->number_ == NULL && ParseText(&q, pattern, 117 if (credit_card_field->number_ == NULL && ParseText(&q, pattern,
118 &credit_card_field->number_)) 118 &credit_card_field->number_))
119 continue; 119 continue;
120 120
121 if ((*q) && LowerCaseEqualsASCII((*q)->form_control_type(), "month")) { 121 if ((*q) && LowerCaseEqualsASCII((*q)->form_control_type, "month")) {
122 credit_card_field->expiration_month_ = *q++; 122 credit_card_field->expiration_month_ = *q++;
123 } else { 123 } else {
124 // "Expiration date" is the most common label here, but some pages have 124 // "Expiration date" is the most common label here, but some pages have
125 // "Expires", "exp. date" or "exp. month" and "exp. year". We also look 125 // "Expires", "exp. date" or "exp. month" and "exp. year". We also look
126 // for the field names ccmonth and ccyear, which appear on at least 4 of 126 // for the field names ccmonth and ccyear, which appear on at least 4 of
127 // our test pages. 127 // our test pages.
128 // 128 //
129 // -> On at least one page (The China Shop2.html) we find only the labels 129 // -> On at least one page (The China Shop2.html) we find only the labels
130 // "month" and "year". So for now we match these words directly; we'll 130 // "month" and "year". So for now we match these words directly; we'll
131 // see if this turns out to be too general. 131 // see if this turns out to be too general.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // (e.g. test page Apple Store Billing.html). We can't handle that yet, 180 // (e.g. test page Apple Store Billing.html). We can't handle that yet,
181 // so we treat the card type as optional for now. 181 // so we treat the card type as optional for now.
182 // The existence of a number or cvc in combination with expiration date is 182 // The existence of a number or cvc in combination with expiration date is
183 // a strong enough signal that this is a credit card. It is possible that 183 // a strong enough signal that this is a credit card. It is possible that
184 // the number and name were parsed in a separate part of the form. So if 184 // the number and name were parsed in a separate part of the form. So if
185 // the cvc and date were found independently they are returned. 185 // the cvc and date were found independently they are returned.
186 if ((credit_card_field->number_ || credit_card_field->verification_) && 186 if ((credit_card_field->number_ || credit_card_field->verification_) &&
187 credit_card_field->expiration_month_ && 187 credit_card_field->expiration_month_ &&
188 (credit_card_field->expiration_year_ || 188 (credit_card_field->expiration_year_ ||
189 (LowerCaseEqualsASCII( 189 (LowerCaseEqualsASCII(
190 credit_card_field->expiration_month_->form_control_type(), 190 credit_card_field->expiration_month_->form_control_type,
191 "month")))) { 191 "month")))) {
192 *iter = q; 192 *iter = q;
193 return credit_card_field.release(); 193 return credit_card_field.release();
194 } 194 }
195 195
196 return NULL; 196 return NULL;
197 } 197 }
198 198
199 CreditCardField::CreditCardField() 199 CreditCardField::CreditCardField()
200 : cardholder_(NULL), 200 : cardholder_(NULL),
201 cardholder_last_(NULL), 201 cardholder_last_(NULL),
202 type_(NULL), 202 type_(NULL),
203 number_(NULL), 203 number_(NULL),
204 verification_(NULL), 204 verification_(NULL),
205 expiration_month_(NULL), 205 expiration_month_(NULL),
206 expiration_year_(NULL) { 206 expiration_year_(NULL) {
207 } 207 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_metrics_unittest.cc ('k') | chrome/browser/autofill/form_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698