OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/credit_card_field.h" | 5 #include "components/autofill/core/browser/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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 cardholder_last_(NULL), | 186 cardholder_last_(NULL), |
187 type_(NULL), | 187 type_(NULL), |
188 number_(NULL), | 188 number_(NULL), |
189 verification_(NULL), | 189 verification_(NULL), |
190 expiration_month_(NULL), | 190 expiration_month_(NULL), |
191 expiration_year_(NULL), | 191 expiration_year_(NULL), |
192 expiration_date_(NULL), | 192 expiration_date_(NULL), |
193 is_two_digit_year_(false) { | 193 is_two_digit_year_(false) { |
194 } | 194 } |
195 | 195 |
196 bool CreditCardField::ClassifyField(FieldTypeMap* map) const { | 196 bool CreditCardField::ClassifyField(ServerFieldTypeMap* map) const { |
197 bool ok = AddClassification(number_, CREDIT_CARD_NUMBER, map); | 197 bool ok = AddClassification(number_, CREDIT_CARD_NUMBER, map); |
198 ok = ok && AddClassification(type_, CREDIT_CARD_TYPE, map); | 198 ok = ok && AddClassification(type_, CREDIT_CARD_TYPE, map); |
199 ok = ok && AddClassification(verification_, CREDIT_CARD_VERIFICATION_CODE, | 199 ok = ok && AddClassification(verification_, CREDIT_CARD_VERIFICATION_CODE, |
200 map); | 200 map); |
201 | 201 |
202 // If the heuristics detected first and last name in separate fields, | 202 // If the heuristics detected first and last name in separate fields, |
203 // then ignore both fields. Putting them into separate fields is probably | 203 // then ignore both fields. Putting them into separate fields is probably |
204 // wrong, because the credit card can also contain a middle name or middle | 204 // wrong, because the credit card can also contain a middle name or middle |
205 // initial. | 205 // initial. |
206 if (cardholder_last_ == NULL) | 206 if (cardholder_last_ == NULL) |
(...skipping 17 matching lines...) Expand all Loading... |
224 ok = ok && AddClassification(expiration_year_, | 224 ok = ok && AddClassification(expiration_year_, |
225 CREDIT_CARD_EXP_4_DIGIT_YEAR, | 225 CREDIT_CARD_EXP_4_DIGIT_YEAR, |
226 map); | 226 map); |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 return ok; | 230 return ok; |
231 } | 231 } |
232 | 232 |
233 } // namespace autofill | 233 } // namespace autofill |
OLD | NEW |