Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/browser/autofill/credit_card_field.h

Issue 7043027: Autofill refactor form_field.h/cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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_FIELD_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_CREDIT_CARD_FIELD_H_
6 #define CHROME_BROWSER_AUTOFILL_CREDIT_CARD_FIELD_H_ 6 #define CHROME_BROWSER_AUTOFILL_CREDIT_CARD_FIELD_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h"
13 #include "chrome/browser/autofill/autofill_type.h" 14 #include "chrome/browser/autofill/autofill_type.h"
14 #include "chrome/browser/autofill/form_field.h" 15 #include "chrome/browser/autofill/form_field.h"
15 16
16 class AutofillField; 17 class AutofillField;
17 class AutofillScanner; 18 class AutofillScanner;
18 19
19 class CreditCardField : public FormField { 20 class CreditCardField : public FormField {
20 public: 21 public:
21 // FormField implementation:
22 virtual bool GetFieldInfo(FieldTypeMap* field_type_map) const OVERRIDE;
23
24 static CreditCardField* Parse(AutofillScanner* scanner, bool is_ecml); 22 static CreditCardField* Parse(AutofillScanner* scanner, bool is_ecml);
25 23
26 private: 24 private:
25 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseMiniumCreditCard);
26 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseMiniumCreditCardEcml);
27 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseFullCreditCard);
28 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseFullCreditCardEcml);
29 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseExpMonthYear);
30 FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseExpMonthYear2);
31
27 CreditCardField(); 32 CreditCardField();
28 33
34 // FormField:
35 virtual bool ClassifyField(FieldTypeMap* map) const OVERRIDE;
36
29 const AutofillField* cardholder_; // Optional. 37 const AutofillField* cardholder_; // Optional.
30 38
31 // Occasionally pages have separate fields for the cardholder's first and 39 // Occasionally pages have separate fields for the cardholder's first and
32 // last names; for such pages cardholder_ holds the first name field and 40 // last names; for such pages cardholder_ holds the first name field and
33 // we store the last name field here. 41 // we store the last name field here.
34 // (We could store an embedded NameField object here, but we don't do so 42 // (We could store an embedded NameField object here, but we don't do so
35 // because the text patterns for matching a cardholder name are different 43 // because the text patterns for matching a cardholder name are different
36 // than for ordinary names, and because cardholder names never have titles, 44 // than for ordinary names, and because cardholder names never have titles,
37 // middle names or suffixes.) 45 // middle names or suffixes.)
38 const AutofillField* cardholder_last_; 46 const AutofillField* cardholder_last_;
39 47
40 // TODO(jhawkins): Parse the select control. 48 // TODO(jhawkins): Parse the select control.
41 const AutofillField* type_; // Optional. 49 const AutofillField* type_; // Optional.
42 const AutofillField* number_; // Required. 50 const AutofillField* number_; // Required.
43 51
44 // The 3-digit card verification number; we don't currently fill this. 52 // The 3-digit card verification number; we don't currently fill this.
45 const AutofillField* verification_; 53 const AutofillField* verification_;
46 54
47 // Both required. TODO(jhawkins): Parse the select control. 55 // Both required. TODO(jhawkins): Parse the select control.
48 const AutofillField* expiration_month_; 56 const AutofillField* expiration_month_;
49 const AutofillField* expiration_year_; 57 const AutofillField* expiration_year_;
50 58
51 DISALLOW_COPY_AND_ASSIGN(CreditCardField); 59 DISALLOW_COPY_AND_ASSIGN(CreditCardField);
52 }; 60 };
53 61
54 #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_FIELD_H_ 62 #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_FIELD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698