| 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/validation.h" | 5 #include "components/autofill/core/browser/validation.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 const base::char16 kSSNSeparators[] = {' ', '-', 0}; | 21 const base::char16 kSSNSeparators[] = {' ', '-', 0}; |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 namespace autofill { | 25 namespace autofill { |
| 26 | 26 |
| 27 bool IsValidCreditCardExpirationDate(const base::string16& year, | 27 bool IsValidCreditCardExpirationDate(const base::string16& year, |
| 28 const base::string16& month, | 28 const base::string16& month, |
| 29 const base::Time& now) { | 29 const base::Time& now) { |
| 30 base::string16 year_cleaned, month_cleaned; | 30 base::string16 year_cleaned, month_cleaned; |
| 31 TrimWhitespace(year, TRIM_ALL, &year_cleaned); | 31 base::TrimWhitespace(year, base::TRIM_ALL, &year_cleaned); |
| 32 TrimWhitespace(month, TRIM_ALL, &month_cleaned); | 32 base::TrimWhitespace(month, base::TRIM_ALL, &month_cleaned); |
| 33 if (year_cleaned.length() != 4) | 33 if (year_cleaned.length() != 4) |
| 34 return false; | 34 return false; |
| 35 | 35 |
| 36 int cc_year; | 36 int cc_year; |
| 37 if (!base::StringToInt(year_cleaned, &cc_year)) | 37 if (!base::StringToInt(year_cleaned, &cc_year)) |
| 38 return false; | 38 return false; |
| 39 | 39 |
| 40 int cc_month; | 40 int cc_month; |
| 41 if (!base::StringToInt(month_cleaned, &cc_month)) | 41 if (!base::StringToInt(month_cleaned, &cc_month)) |
| 42 return false; | 42 return false; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 number_string.begin() + 9), | 210 number_string.begin() + 9), |
| 211 &serial) | 211 &serial) |
| 212 || serial == 0) { | 212 || serial == 0) { |
| 213 return false; | 213 return false; |
| 214 } | 214 } |
| 215 | 215 |
| 216 return true; | 216 return true; |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace autofill | 219 } // namespace autofill |
| OLD | NEW |