ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / components / autofill / core / browser / credit_card_field.h
blob3dc62fac34e2d0adb86e97ab0bc4887cd3d5b093
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "components/autofill/core/browser/autofill_type.h"
15 #include "components/autofill/core/browser/form_field.h"
17 namespace autofill {
19 class AutofillField;
20 class AutofillScanner;
22 class CreditCardField : public FormField {
23 public:
24 ~CreditCardField() override;
25 static scoped_ptr<FormField> Parse(AutofillScanner* scanner);
27 protected:
28 // FormField:
29 bool ClassifyField(ServerFieldTypeMap* map) const override;
31 private:
32 friend class CreditCardFieldTest;
34 CreditCardField();
36 // For the combined expiration field we return |exp_year_type_|; otherwise if
37 // |expiration_year_| is having year with |max_length| of 2-digits we return
38 // |CREDIT_CARD_EXP_2_DIGIT_YEAR|; otherwise |CREDIT_CARD_EXP_4_DIGIT_YEAR|.
39 ServerFieldType GetExpirationYearType() const;
41 AutofillField* cardholder_; // Optional.
43 // Occasionally pages have separate fields for the cardholder's first and
44 // last names; for such pages |cardholder_| holds the first name field and
45 // we store the last name field here.
46 // (We could store an embedded |NameField| object here, but we don't do so
47 // because the text patterns for matching a cardholder name are different
48 // than for ordinary names, and because cardholder names never have titles,
49 // middle names or suffixes.)
50 AutofillField* cardholder_last_;
52 AutofillField* type_; // Optional.
53 std::vector<AutofillField*> numbers_; // Required.
55 // The 3-digit card verification number; we don't currently fill this.
56 AutofillField* verification_;
58 // Either |expiration_date_| or both |expiration_month_| and
59 // |expiration_year_| are required.
60 AutofillField* expiration_month_;
61 AutofillField* expiration_year_;
62 AutofillField* expiration_date_;
64 // For combined expiration field having year as 2-digits we store here
65 // |CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR|; otherwise we store
66 // |CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR|.
67 ServerFieldType exp_year_type_;
69 DISALLOW_COPY_AND_ASSIGN(CreditCardField);
72 } // namespace autofill
74 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_