| 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" |
| 11 #include "chrome/browser/autofill/form_group.h" | 11 #include "chrome/browser/autofill/form_group.h" |
| 12 | 12 |
| 13 // A form group that stores credit card information. | 13 // A form group that stores credit card information. |
| 14 class CreditCard : public FormGroup { | 14 class CreditCard : public FormGroup { |
| 15 public: | 15 public: |
| 16 explicit CreditCard(const string16& label); | 16 explicit CreditCard(const string16& label); |
| 17 // Used for STL. |
| 18 explicit CreditCard(const CreditCard& card); |
| 17 | 19 |
| 18 // FormGroup implementation: | 20 // FormGroup implementation: |
| 19 FormGroup* Clone() const; | 21 FormGroup* Clone() const; |
| 20 virtual void GetPossibleFieldTypes(const string16& text, | 22 virtual void GetPossibleFieldTypes(const string16& text, |
| 21 FieldTypeSet* possible_types) const; | 23 FieldTypeSet* possible_types) const; |
| 22 virtual void FindInfoMatches(const AutoFillType& type, | 24 virtual void FindInfoMatches(const AutoFillType& type, |
| 23 const string16& info, | 25 const string16& info, |
| 24 std::vector<string16>* matched_text) const; | 26 std::vector<string16>* matched_text) const; |
| 25 virtual string16 GetFieldText(const AutoFillType& type) const; | 27 virtual string16 GetFieldText(const AutoFillType& type) const; |
| 26 virtual string16 GetPreviewText(const AutoFillType& type) const; | 28 virtual string16 GetPreviewText(const AutoFillType& type) const; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void set_last_four_digits(const string16& last_four_digits) { | 61 void set_last_four_digits(const string16& last_four_digits) { |
| 60 last_four_digits_ = last_four_digits; | 62 last_four_digits_ = last_four_digits; |
| 61 } | 63 } |
| 62 | 64 |
| 63 // These setters verify that the month and year are within appropriate | 65 // These setters verify that the month and year are within appropriate |
| 64 // ranges. | 66 // ranges. |
| 65 void set_expiration_month(int expiration_month); | 67 void set_expiration_month(int expiration_month); |
| 66 void set_expiration_year(int expiration_year); | 68 void set_expiration_year(int expiration_year); |
| 67 | 69 |
| 68 private: | 70 private: |
| 69 explicit CreditCard(const CreditCard& card); | |
| 70 void operator=(const CreditCard& card); | 71 void operator=(const CreditCard& card); |
| 71 | 72 |
| 72 // A helper function for FindInfoMatches that only handles matching the info | 73 // A helper function for FindInfoMatches that only handles matching the info |
| 73 // with the requested field type. | 74 // with the requested field type. |
| 74 bool FindInfoMatchesHelper(const AutoFillFieldType& field_type, | 75 bool FindInfoMatchesHelper(const AutoFillFieldType& field_type, |
| 75 const string16& info, | 76 const string16& info, |
| 76 string16* match) const; | 77 string16* match) const; |
| 77 | 78 |
| 78 // Returns true if |text| matches the name on the card. The comparison is | 79 // Returns true if |text| matches the name on the card. The comparison is |
| 79 // case-insensitive. | 80 // case-insensitive. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 117 |
| 117 // These members are zero if not present. | 118 // These members are zero if not present. |
| 118 int expiration_month_; | 119 int expiration_month_; |
| 119 int expiration_year_; | 120 int expiration_year_; |
| 120 | 121 |
| 121 // This is the display name of the card set by the user, e.g., Amazon Visa. | 122 // This is the display name of the card set by the user, e.g., Amazon Visa. |
| 122 string16 label_; | 123 string16 label_; |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ | 126 #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ |
| OLD | NEW |