| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 void operator=(const CreditCard& credit_card); | 51 void operator=(const CreditCard& credit_card); |
| 52 | 52 |
| 53 // Comparison for Sync. Returns 0 if the credit card is the same as |this|, | 53 // Comparison for Sync. Returns 0 if the credit card is the same as |this|, |
| 54 // or < 0, or > 0 if it is different. The implied ordering can be used for | 54 // or < 0, or > 0 if it is different. The implied ordering can be used for |
| 55 // culling duplicates. The ordering is based on collation order of the | 55 // culling duplicates. The ordering is based on collation order of the |
| 56 // textual contents of the fields. | 56 // textual contents of the fields. |
| 57 // GUIDs, labels, and unique IDs are not compared, only the values of the | 57 // GUIDs, labels, and unique IDs are not compared, only the values of the |
| 58 // credit cards themselves. | 58 // credit cards themselves. |
| 59 int Compare(const CreditCard& credit_card) const; | 59 int Compare(const CreditCard& credit_card) const; |
| 60 | 60 |
| 61 // This is same as |Compare| for credit cards as they are single-valued. |
| 62 // This is here to unify templated code that deals with |FormGroup|s. |
| 63 int CompareMulti(const CreditCard& credit_card) const; |
| 64 |
| 61 // Used by tests. | 65 // Used by tests. |
| 62 bool operator==(const CreditCard& credit_card) const; | 66 bool operator==(const CreditCard& credit_card) const; |
| 63 bool operator!=(const CreditCard& credit_card) const; | 67 bool operator!=(const CreditCard& credit_card) const; |
| 64 | 68 |
| 65 // Return a version of |number| that has any separator characters removed. | 69 // Return a version of |number| that has any separator characters removed. |
| 66 static const string16 StripSeparators(const string16& number); | 70 static const string16 StripSeparators(const string16& number); |
| 67 | 71 |
| 68 // Returns true if |text| looks like a valid credit card number. | 72 // Returns true if |text| looks like a valid credit card number. |
| 69 // Uses the Luhn formula to validate the number. | 73 // Uses the Luhn formula to validate the number. |
| 70 static bool IsValidCreditCardNumber(const string16& text); | 74 static bool IsValidCreditCardNumber(const string16& text); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 extern const char* const kAmericanExpressCard; | 138 extern const char* const kAmericanExpressCard; |
| 135 extern const char* const kDinersCard; | 139 extern const char* const kDinersCard; |
| 136 extern const char* const kDiscoverCard; | 140 extern const char* const kDiscoverCard; |
| 137 extern const char* const kGenericCard; | 141 extern const char* const kGenericCard; |
| 138 extern const char* const kJCBCard; | 142 extern const char* const kJCBCard; |
| 139 extern const char* const kMasterCard; | 143 extern const char* const kMasterCard; |
| 140 extern const char* const kSoloCard; | 144 extern const char* const kSoloCard; |
| 141 extern const char* const kVisaCard; | 145 extern const char* const kVisaCard; |
| 142 | 146 |
| 143 #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ | 147 #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ |
| OLD | NEW |