| 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // Constants for the length of a CVC. | 23 // Constants for the length of a CVC. |
| 24 static const size_t GENERAL_CVC_LENGTH = 3; | 24 static const size_t GENERAL_CVC_LENGTH = 3; |
| 25 static const size_t AMEX_CVC_LENGTH = 4; | 25 static const size_t AMEX_CVC_LENGTH = 4; |
| 26 | 26 |
| 27 // Used to express the completion status of a credit card. | 27 // Used to express the completion status of a credit card. |
| 28 typedef uint32_t CreditCardCompletionStatus; | 28 typedef uint32_t CreditCardCompletionStatus; |
| 29 static const CreditCardCompletionStatus CREDIT_CARD_COMPLETE = 0; | 29 static const CreditCardCompletionStatus CREDIT_CARD_COMPLETE = 0; |
| 30 static const CreditCardCompletionStatus CREDIT_CARD_EXPIRED = 1 << 0; | 30 static const CreditCardCompletionStatus CREDIT_CARD_EXPIRED = 1 << 0; |
| 31 static const CreditCardCompletionStatus CREDIT_CARD_NO_CARDHOLDER = 1 << 1; | 31 static const CreditCardCompletionStatus CREDIT_CARD_NO_CARDHOLDER = 1 << 1; |
| 32 static const CreditCardCompletionStatus CREDIT_CARD_NO_NUMBER = 1 << 2; | 32 static const CreditCardCompletionStatus CREDIT_CARD_NO_NUMBER = 1 << 2; |
| 33 static const CreditCardCompletionStatus CREDIT_CARD_NO_BILLING_ADDRESS = 1 << 3; |
| 33 | 34 |
| 34 // Returns true if |year| and |month| describe a date later than |now|. | 35 // Returns true if |year| and |month| describe a date later than |now|. |
| 35 // |year| must have 4 digits. | 36 // |year| must have 4 digits. |
| 36 bool IsValidCreditCardExpirationDate(int year, | 37 bool IsValidCreditCardExpirationDate(int year, |
| 37 int month, | 38 int month, |
| 38 const base::Time& now); | 39 const base::Time& now); |
| 39 | 40 |
| 40 // Returns true if |text| looks like a valid credit card number. | 41 // Returns true if |text| looks like a valid credit card number. |
| 41 // Uses the Luhn formula to validate the number. | 42 // Uses the Luhn formula to validate the number. |
| 42 bool IsValidCreditCardNumber(const base::string16& text); | 43 bool IsValidCreditCardNumber(const base::string16& text); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Returns the expected CVC length based on the |card_type|. | 96 // Returns the expected CVC length based on the |card_type|. |
| 96 size_t GetCvcLengthForCardType(const base::StringPiece card_type); | 97 size_t GetCvcLengthForCardType(const base::StringPiece card_type); |
| 97 | 98 |
| 98 // Returns true if |value| appears to be a UPI Virtual Payment Address. | 99 // Returns true if |value| appears to be a UPI Virtual Payment Address. |
| 99 // https://upipayments.co.in/virtual-payment-address-vpa/ | 100 // https://upipayments.co.in/virtual-payment-address-vpa/ |
| 100 bool IsUPIVirtualPaymentAddress(const base::string16& value); | 101 bool IsUPIVirtualPaymentAddress(const base::string16& value); |
| 101 | 102 |
| 102 } // namespace autofill | 103 } // namespace autofill |
| 103 | 104 |
| 104 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ | 105 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ |
| OLD | NEW |