| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 ParseField(scanner, pattern, &credit_card_field->verification_)) { | 87 ParseField(scanner, pattern, &credit_card_field->verification_)) { |
| 88 continue; | 88 continue; |
| 89 } | 89 } |
| 90 | 90 |
| 91 pattern = base::UTF8ToUTF16(autofill::kCardNumberRe); | 91 pattern = base::UTF8ToUTF16(autofill::kCardNumberRe); |
| 92 if (!credit_card_field->number_ && | 92 if (!credit_card_field->number_ && |
| 93 ParseField(scanner, pattern, &credit_card_field->number_)) { | 93 ParseField(scanner, pattern, &credit_card_field->number_)) { |
| 94 continue; | 94 continue; |
| 95 } | 95 } |
| 96 | 96 |
| 97 if (LowerCaseEqualsASCII(scanner->Cursor()->form_control_type, "month")) { | 97 if (base::LowerCaseEqualsASCII(scanner->Cursor()->form_control_type, |
| 98 "month")) { |
| 98 credit_card_field->expiration_date_ = scanner->Cursor(); | 99 credit_card_field->expiration_date_ = scanner->Cursor(); |
| 99 scanner->Advance(); | 100 scanner->Advance(); |
| 100 } else { | 101 } else { |
| 101 // First try to parse split month/year expiration fields. | 102 // First try to parse split month/year expiration fields. |
| 102 scanner->SaveCursor(); | 103 scanner->SaveCursor(); |
| 103 pattern = base::UTF8ToUTF16(autofill::kExpirationMonthRe); | 104 pattern = base::UTF8ToUTF16(autofill::kExpirationMonthRe); |
| 104 if (!credit_card_field->expiration_month_ && | 105 if (!credit_card_field->expiration_month_ && |
| 105 ParseFieldSpecifics(scanner, pattern, MATCH_DEFAULT | MATCH_SELECT, | 106 ParseFieldSpecifics(scanner, pattern, MATCH_DEFAULT | MATCH_SELECT, |
| 106 &credit_card_field->expiration_month_)) { | 107 &credit_card_field->expiration_month_)) { |
| 107 pattern = base::UTF8ToUTF16(autofill::kExpirationYearRe); | 108 pattern = base::UTF8ToUTF16(autofill::kExpirationYearRe); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 ok = ok && AddClassification(expiration_year_, | 222 ok = ok && AddClassification(expiration_year_, |
| 222 CREDIT_CARD_EXP_4_DIGIT_YEAR, | 223 CREDIT_CARD_EXP_4_DIGIT_YEAR, |
| 223 map); | 224 map); |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 | 227 |
| 227 return ok; | 228 return ok; |
| 228 } | 229 } |
| 229 | 230 |
| 230 } // namespace autofill | 231 } // namespace autofill |
| OLD | NEW |