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

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

Issue 1001193002: Autofill: Better recognize credit card fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 9 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"
(...skipping 13 matching lines...) Expand all
24 ~CreditCardField() override; 24 ~CreditCardField() override;
25 static scoped_ptr<FormField> Parse(AutofillScanner* scanner); 25 static scoped_ptr<FormField> Parse(AutofillScanner* scanner);
26 26
27 protected: 27 protected:
28 // FormField: 28 // FormField:
29 bool ClassifyField(ServerFieldTypeMap* map) const override; 29 bool ClassifyField(ServerFieldTypeMap* map) const override;
30 30
31 private: 31 private:
32 friend class CreditCardFieldTest; 32 friend class CreditCardFieldTest;
33 33
34 // Examines the current field pointed to by |scanner|, if it exists, and
35 // returns true if the field has a high chance of being of a given type.
36 static bool LikelyCardNumberField(AutofillScanner* scanner);
37 static bool LikelyCardType(AutofillScanner* scanner);
38
39 // Same as above, but a bit less likely since what looks like a CVC field may
40 // also be part of a credit card field.
41 static bool MayBeCardCVCField(AutofillScanner* scanner);
42
43 // A couple common arguments used for match types.
44 static const int kMatchNumAndTel;
45 static const int kMatchNumTelAndPass;
46
34 CreditCardField(); 47 CreditCardField();
35 48
36 // Parses the expiration month/year/date fields. Returns true if it finds 49 // Parses the expiration month/year/date fields. Returns true if it finds
37 // something new. 50 // something new.
38 bool ParseExpirationDate(AutofillScanner* scanner); 51 bool ParseExpirationDate(AutofillScanner* scanner);
39 52
40 // For the combined expiration field we return |exp_year_type_|; otherwise if 53 // For the combined expiration field we return |exp_year_type_|; otherwise if
41 // |expiration_year_| is having year with |max_length| of 2-digits we return 54 // |expiration_year_| is having year with |max_length| of 2-digits we return
42 // |CREDIT_CARD_EXP_2_DIGIT_YEAR|; otherwise |CREDIT_CARD_EXP_4_DIGIT_YEAR|. 55 // |CREDIT_CARD_EXP_2_DIGIT_YEAR|; otherwise |CREDIT_CARD_EXP_4_DIGIT_YEAR|.
43 ServerFieldType GetExpirationYearType() const; 56 ServerFieldType GetExpirationYearType() const;
(...skipping 25 matching lines...) Expand all
69 // |CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR|; otherwise we store 82 // |CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR|; otherwise we store
70 // |CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR|. 83 // |CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR|.
71 ServerFieldType exp_year_type_; 84 ServerFieldType exp_year_type_;
72 85
73 DISALLOW_COPY_AND_ASSIGN(CreditCardField); 86 DISALLOW_COPY_AND_ASSIGN(CreditCardField);
74 }; 87 };
75 88
76 } // namespace autofill 89 } // namespace autofill
77 90
78 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_ 91 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_FIELD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698