OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_AUTOFILL_BROWSER_CREDIT_CARD_FIELD_H_ | |
6 #define COMPONENTS_AUTOFILL_BROWSER_CREDIT_CARD_FIELD_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/compiler_specific.h" | |
12 #include "base/gtest_prod_util.h" | |
13 #include "components/autofill/browser/autofill_type.h" | |
14 #include "components/autofill/browser/form_field.h" | |
15 | |
16 namespace autofill { | |
17 | |
18 class AutofillField; | |
19 class AutofillScanner; | |
20 | |
21 class CreditCardField : public FormField { | |
22 public: | |
23 static FormField* Parse(AutofillScanner* scanner); | |
24 | |
25 protected: | |
26 // FormField: | |
27 virtual bool ClassifyField(FieldTypeMap* map) const OVERRIDE; | |
28 | |
29 private: | |
30 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseMiniumCreditCard); | |
31 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseFullCreditCard); | |
32 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseCreditCardType); | |
33 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseExpMonthYear); | |
34 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseExpMonthYear2); | |
35 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseExpField); | |
36 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseExpField2DigitYear); | |
37 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, | |
38 ParseCreditCardHolderNameWithCCFullName); | |
39 | |
40 CreditCardField(); | |
41 | |
42 const AutofillField* cardholder_; // Optional. | |
43 | |
44 // Occasionally pages have separate fields for the cardholder's first and | |
45 // last names; for such pages cardholder_ holds the first name field and | |
46 // we store the last name field here. | |
47 // (We could store an embedded NameField object here, but we don't do so | |
48 // because the text patterns for matching a cardholder name are different | |
49 // than for ordinary names, and because cardholder names never have titles, | |
50 // middle names or suffixes.) | |
51 const AutofillField* cardholder_last_; | |
52 | |
53 // TODO(jhawkins): Parse the select control. | |
54 const AutofillField* type_; // Optional. | |
55 const AutofillField* number_; // Required. | |
56 | |
57 // The 3-digit card verification number; we don't currently fill this. | |
58 const AutofillField* verification_; | |
59 | |
60 // Either |expiration_date_| or both |expiration_month_| and | |
61 // |expiration_year_| are required. | |
62 const AutofillField* expiration_month_; | |
63 const AutofillField* expiration_year_; | |
64 const AutofillField* expiration_date_; | |
65 | |
66 // True if the year is detected to be a 2-digit year; otherwise, we assume | |
67 // a 4-digit year. | |
68 bool is_two_digit_year_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(CreditCardField); | |
71 }; | |
72 | |
73 } // namespace autofill | |
74 | |
75 #endif // COMPONENTS_AUTOFILL_BROWSER_CREDIT_CARD_FIELD_H_ | |
OLD | NEW |