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