| 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_CREDIT_CARD_FIELD_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 ~CreditCardField() override; | 24 ~CreditCardField() override; |
| 25 static scoped_ptr<FormField> Parse(AutofillScanner* scanner); | 25 static scoped_ptr<FormField> Parse(AutofillScanner* scanner); |
| 26 | 26 |
| 27 protected: | 27 protected: |
| 28 // FormField: | 28 // FormField: |
| 29 bool ClassifyField(ServerFieldTypeMap* map) const override; | 29 bool ClassifyField(ServerFieldTypeMap* map) const override; |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 friend class CreditCardFieldTest; | 32 friend class CreditCardFieldTest; |
| 33 | 33 |
| 34 // Returns true if |scanner| points to a field that looks like a month |
| 35 // <select>. |
| 36 static bool LikelyCardMonthSelectField(AutofillScanner* scanner); |
| 37 |
| 38 // Returns true if |scanner| points to a field that looks like a year |
| 39 // <select> for a credit card. i.e. it contains the current year and |
| 40 // the next few years. |
| 41 static bool LikelyCardYearSelectField(AutofillScanner* scanner); |
| 42 |
| 34 CreditCardField(); | 43 CreditCardField(); |
| 35 | 44 |
| 36 // Parses the expiration month/year/date fields. Returns true if it finds | 45 // Parses the expiration month/year/date fields. Returns true if it finds |
| 37 // something new. | 46 // something new. |
| 38 bool ParseExpirationDate(AutofillScanner* scanner); | 47 bool ParseExpirationDate(AutofillScanner* scanner); |
| 39 | 48 |
| 40 // For the combined expiration field we return |exp_year_type_|; otherwise if | 49 // For the combined expiration field we return |exp_year_type_|; otherwise if |
| 41 // |expiration_year_| is having year with |max_length| of 2-digits we return | 50 // |expiration_year_| is having year with |max_length| of 2-digits we return |
| 42 // |CREDIT_CARD_EXP_2_DIGIT_YEAR|; otherwise |CREDIT_CARD_EXP_4_DIGIT_YEAR|. | 51 // |CREDIT_CARD_EXP_2_DIGIT_YEAR|; otherwise |CREDIT_CARD_EXP_4_DIGIT_YEAR|. |
| 43 ServerFieldType GetExpirationYearType() const; | 52 ServerFieldType GetExpirationYearType() const; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 69 // |CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR|; otherwise we store | 78 // |CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR|; otherwise we store |
| 70 // |CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR|. | 79 // |CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR|. |
| 71 ServerFieldType exp_year_type_; | 80 ServerFieldType exp_year_type_; |
| 72 | 81 |
| 73 DISALLOW_COPY_AND_ASSIGN(CreditCardField); | 82 DISALLOW_COPY_AND_ASSIGN(CreditCardField); |
| 74 }; | 83 }; |
| 75 | 84 |
| 76 } // namespace autofill | 85 } // namespace autofill |
| 77 | 86 |
| 78 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_ | 87 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_ |
| OLD | NEW |