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

Side by Side Diff: components/autofill/core/browser/credit_card_field.h

Issue 381613005: [Autofill] Autofill fails to fill credit card number when split across fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed const qualifiers from FormField and AutofillScanner implementation. Created 6 years, 4 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
OLDNEW
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"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "components/autofill/core/browser/autofill_type.h" 13 #include "components/autofill/core/browser/autofill_type.h"
14 #include "components/autofill/core/browser/form_field.h" 14 #include "components/autofill/core/browser/form_field.h"
15 15
16 namespace autofill { 16 namespace autofill {
17 17
18 class AutofillField; 18 class AutofillField;
19 class AutofillScanner; 19 class AutofillScanner;
20 20
21 class CreditCardField : public FormField { 21 class CreditCardField : public FormField {
22 public: 22 public:
23 virtual ~CreditCardField();
23 static FormField* Parse(AutofillScanner* scanner); 24 static FormField* Parse(AutofillScanner* scanner);
24 25
25 protected: 26 protected:
26 // FormField: 27 // FormField:
27 virtual bool ClassifyField(ServerFieldTypeMap* map) const OVERRIDE; 28 virtual bool ClassifyField(ServerFieldTypeMap* map) const OVERRIDE;
28 29
29 private: 30 private:
30 friend class CreditCardFieldTest; 31 friend class CreditCardFieldTest;
31 32
32 CreditCardField(); 33 CreditCardField();
33 34
34 const AutofillField* cardholder_; // Optional. 35 AutofillField* cardholder_; // Optional.
35 36
36 // Occasionally pages have separate fields for the cardholder's first and 37 // Occasionally pages have separate fields for the cardholder's first and
37 // last names; for such pages cardholder_ holds the first name field and 38 // last names; for such pages cardholder_ holds the first name field and
38 // we store the last name field here. 39 // we store the last name field here.
39 // (We could store an embedded NameField object here, but we don't do so 40 // (We could store an embedded NameField object here, but we don't do so
40 // because the text patterns for matching a cardholder name are different 41 // because the text patterns for matching a cardholder name are different
41 // than for ordinary names, and because cardholder names never have titles, 42 // than for ordinary names, and because cardholder names never have titles,
42 // middle names or suffixes.) 43 // middle names or suffixes.)
43 const AutofillField* cardholder_last_; 44 AutofillField* cardholder_last_;
44 45
45 // TODO(jhawkins): Parse the select control. 46 // TODO(jhawkins): Parse the select control.
46 const AutofillField* type_; // Optional. 47 AutofillField* type_; // Optional.
47 const AutofillField* number_; // Required. 48 std::vector<AutofillField*> numbers_; // Required.
48 49
49 // The 3-digit card verification number; we don't currently fill this. 50 // The 3-digit card verification number; we don't currently fill this.
50 const AutofillField* verification_; 51 AutofillField* verification_;
51 52
52 // Either |expiration_date_| or both |expiration_month_| and 53 // Either |expiration_date_| or both |expiration_month_| and
53 // |expiration_year_| are required. 54 // |expiration_year_| are required.
54 const AutofillField* expiration_month_; 55 AutofillField* expiration_month_;
55 const AutofillField* expiration_year_; 56 AutofillField* expiration_year_;
56 const AutofillField* expiration_date_; 57 AutofillField* expiration_date_;
57 58
58 // True if the year is detected to be a 2-digit year; otherwise, we assume 59 // True if the year is detected to be a 2-digit year; otherwise, we assume
59 // a 4-digit year. 60 // a 4-digit year.
60 bool is_two_digit_year_; 61 bool is_two_digit_year_;
61 62
63 // True if credit card number field splits do not exceed
64 // |kMaxValidCardNumberSize|; false otherwise.
65 bool is_valid_card_number_split_;
66
62 DISALLOW_COPY_AND_ASSIGN(CreditCardField); 67 DISALLOW_COPY_AND_ASSIGN(CreditCardField);
63 }; 68 };
64 69
65 } // namespace autofill 70 } // namespace autofill
66 71
67 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_ 72 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698