| 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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 ok = ok && AddClassification(expiration_month_, CREDIT_CARD_EXP_MONTH, map); | 337 ok = ok && AddClassification(expiration_month_, CREDIT_CARD_EXP_MONTH, map); |
| 338 ok = | 338 ok = |
| 339 ok && AddClassification(expiration_year_, GetExpirationYearType(), map); | 339 ok && AddClassification(expiration_year_, GetExpirationYearType(), map); |
| 340 } | 340 } |
| 341 | 341 |
| 342 return ok; | 342 return ok; |
| 343 } | 343 } |
| 344 | 344 |
| 345 bool CreditCardField::ParseExpirationDate(AutofillScanner* scanner) { | 345 bool CreditCardField::ParseExpirationDate(AutofillScanner* scanner) { |
| 346 if (!expiration_date_ && | 346 if (!expiration_date_ && |
| 347 LowerCaseEqualsASCII(scanner->Cursor()->form_control_type, "month")) { | 347 base::LowerCaseEqualsASCII(scanner->Cursor()->form_control_type, |
| 348 "month")) { |
| 348 expiration_date_ = scanner->Cursor(); | 349 expiration_date_ = scanner->Cursor(); |
| 349 expiration_month_ = nullptr; | 350 expiration_month_ = nullptr; |
| 350 expiration_year_ = nullptr; | 351 expiration_year_ = nullptr; |
| 351 scanner->Advance(); | 352 scanner->Advance(); |
| 352 return true; | 353 return true; |
| 353 } | 354 } |
| 354 | 355 |
| 355 if (expiration_month_ || expiration_date_) | 356 if (expiration_month_ || expiration_date_) |
| 356 return false; | 357 return false; |
| 357 | 358 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 | 452 |
| 452 ServerFieldType CreditCardField::GetExpirationYearType() const { | 453 ServerFieldType CreditCardField::GetExpirationYearType() const { |
| 453 return (expiration_date_ | 454 return (expiration_date_ |
| 454 ? exp_year_type_ | 455 ? exp_year_type_ |
| 455 : ((expiration_year_ && expiration_year_->max_length == 2) | 456 : ((expiration_year_ && expiration_year_->max_length == 2) |
| 456 ? CREDIT_CARD_EXP_2_DIGIT_YEAR | 457 ? CREDIT_CARD_EXP_2_DIGIT_YEAR |
| 457 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); | 458 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); |
| 458 } | 459 } |
| 459 | 460 |
| 460 } // namespace autofill | 461 } // namespace autofill |
| OLD | NEW |