| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ | 6 #define CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // Used by tests. | 53 // Used by tests. |
| 54 bool operator==(const CreditCard& creditcard) const; | 54 bool operator==(const CreditCard& creditcard) const; |
| 55 bool operator!=(const CreditCard& creditcard) const; | 55 bool operator!=(const CreditCard& creditcard) const; |
| 56 void set_label(const string16& label) { label_ = label; } | 56 void set_label(const string16& label) { label_ = label; } |
| 57 | 57 |
| 58 // Returns true if |value| is a credit card number. Uses the Luhn formula to | 58 // Returns true if |value| is a credit card number. Uses the Luhn formula to |
| 59 // validate the number. | 59 // validate the number. |
| 60 static bool IsCreditCardNumber(const string16& text); | 60 static bool IsCreditCardNumber(const string16& text); |
| 61 | 61 |
| 62 // Returns true if there are no values (field types) set. |
| 63 bool IsEmpty() const; |
| 64 |
| 62 private: | 65 private: |
| 63 // The month and year are zero if not present. | 66 // The month and year are zero if not present. |
| 64 int Expiration4DigitYear() const { return expiration_year_; } | 67 int Expiration4DigitYear() const { return expiration_year_; } |
| 65 int Expiration2DigitYear() const { return expiration_year_ % 100; } | 68 int Expiration2DigitYear() const { return expiration_year_ % 100; } |
| 66 string16 ExpirationMonthAsString() const; | 69 string16 ExpirationMonthAsString() const; |
| 67 string16 Expiration4DigitYearAsString() const; | 70 string16 Expiration4DigitYearAsString() const; |
| 68 string16 Expiration2DigitYearAsString() const; | 71 string16 Expiration2DigitYearAsString() const; |
| 69 | 72 |
| 70 // Sets |expiration_month_| to the integer conversion of |text|. | 73 // Sets |expiration_month_| to the integer conversion of |text|. |
| 71 void SetExpirationMonthFromString(const string16& text); | 74 void SetExpirationMonthFromString(const string16& text); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 string16 billing_address_; | 145 string16 billing_address_; |
| 143 | 146 |
| 144 // The unique ID of this credit card. | 147 // The unique ID of this credit card. |
| 145 int unique_id_; | 148 int unique_id_; |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 // So we can compare CreditCards with EXPECT_EQ(). | 151 // So we can compare CreditCards with EXPECT_EQ(). |
| 149 std::ostream& operator<<(std::ostream& os, const CreditCard& creditcard); | 152 std::ostream& operator<<(std::ostream& os, const CreditCard& creditcard); |
| 150 | 153 |
| 151 #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ | 154 #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ |
| OLD | NEW |