| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "chrome/browser/autofill/form_group.h" | 12 #include "chrome/browser/autofill/form_group.h" |
| 13 | 13 |
| 14 // A form group that stores credit card information. | 14 // A form group that stores credit card information. |
| 15 class CreditCard : public FormGroup { | 15 class CreditCard : public FormGroup { |
| 16 public: | 16 public: |
| 17 explicit CreditCard(const std::string& guid); | 17 explicit CreditCard(const std::string& guid); |
| 18 | 18 |
| 19 // For use in STL containers. | 19 // For use in STL containers. |
| 20 CreditCard(); | 20 CreditCard(); |
| 21 CreditCard(const CreditCard& credit_card); | 21 CreditCard(const CreditCard& credit_card); |
| 22 virtual ~CreditCard(); | 22 virtual ~CreditCard(); |
| 23 | 23 |
| 24 // FormGroup implementation: | 24 // FormGroup implementation: |
| 25 virtual void GetPossibleFieldTypes(const string16& text, | 25 virtual void GetPossibleFieldTypes(const string16& text, |
| 26 FieldTypeSet* possible_types) const; | 26 FieldTypeSet* possible_types) const; |
| 27 virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; | 27 virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; |
| 28 virtual void FindInfoMatches(const AutofillType& type, | 28 virtual void FindInfoMatches(AutofillFieldType type, |
| 29 const string16& info, | 29 const string16& info, |
| 30 std::vector<string16>* matched_text) const; | 30 std::vector<string16>* matched_text) const; |
| 31 virtual string16 GetFieldText(const AutofillType& type) const; | 31 virtual string16 GetFieldText(AutofillFieldType type) const; |
| 32 virtual string16 GetPreviewText(const AutofillType& type) const; | 32 virtual string16 GetPreviewText(AutofillFieldType type) const; |
| 33 virtual void SetInfo(const AutofillType& type, const string16& value); | 33 virtual void SetInfo(AutofillFieldType type, const string16& value); |
| 34 virtual const string16 Label() const; | 34 virtual const string16 Label() const; |
| 35 | 35 |
| 36 // Special method to set value for HTML5 month input type. | 36 // Special method to set value for HTML5 month input type. |
| 37 void SetInfoForMonthInputType(const string16& value); | 37 void SetInfoForMonthInputType(const string16& value); |
| 38 | 38 |
| 39 // The number altered for display, for example: ******1234 | 39 // The number altered for display, for example: ******1234 |
| 40 string16 ObfuscatedNumber() const; | 40 string16 ObfuscatedNumber() const; |
| 41 // Credit card preview summary, for example: ******1234, Exp: 01/2020 | 41 // Credit card preview summary, for example: ******1234, Exp: 01/2020 |
| 42 string16 PreviewSummary() const; | 42 string16 PreviewSummary() const; |
| 43 // The last four digits of the credit card number. | 43 // The last four digits of the credit card number. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 last_four_digits_ = last_four_digits; | 102 last_four_digits_ = last_four_digits; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // These setters verify that the month and year are within appropriate | 105 // These setters verify that the month and year are within appropriate |
| 106 // ranges. | 106 // ranges. |
| 107 void set_expiration_month(int expiration_month); | 107 void set_expiration_month(int expiration_month); |
| 108 void set_expiration_year(int expiration_year); | 108 void set_expiration_year(int expiration_year); |
| 109 | 109 |
| 110 // A helper function for FindInfoMatches that only handles matching the info | 110 // A helper function for FindInfoMatches that only handles matching the info |
| 111 // with the requested field type. | 111 // with the requested field type. |
| 112 bool FindInfoMatchesHelper(const AutofillFieldType& field_type, | 112 bool FindInfoMatchesHelper(AutofillFieldType field_type, |
| 113 const string16& info, | 113 const string16& info, |
| 114 string16* match) const; | 114 string16* match) const; |
| 115 | 115 |
| 116 // Returns true if |text| matches the name on the card. The comparison is | 116 // Returns true if |text| matches the name on the card. The comparison is |
| 117 // case-insensitive. | 117 // case-insensitive. |
| 118 bool IsNameOnCard(const string16& text) const; | 118 bool IsNameOnCard(const string16& text) const; |
| 119 | 119 |
| 120 // Returns true if |text| matches the expiration month of the card. | 120 // Returns true if |text| matches the expiration month of the card. |
| 121 bool IsExpirationMonth(const string16& text) const; | 121 bool IsExpirationMonth(const string16& text) const; |
| 122 | 122 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 extern const char* const kAmericanExpressCard; | 157 extern const char* const kAmericanExpressCard; |
| 158 extern const char* const kDinersCard; | 158 extern const char* const kDinersCard; |
| 159 extern const char* const kDiscoverCard; | 159 extern const char* const kDiscoverCard; |
| 160 extern const char* const kGenericCard; | 160 extern const char* const kGenericCard; |
| 161 extern const char* const kJCBCard; | 161 extern const char* const kJCBCard; |
| 162 extern const char* const kMasterCard; | 162 extern const char* const kMasterCard; |
| 163 extern const char* const kSoloCard; | 163 extern const char* const kSoloCard; |
| 164 extern const char* const kVisaCard; | 164 extern const char* const kVisaCard; |
| 165 | 165 |
| 166 #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ | 166 #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ |
| OLD | NEW |