Chromium Code Reviews| Index: chrome/browser/autofill/form_field.h |
| diff --git a/chrome/browser/autofill/form_field.h b/chrome/browser/autofill/form_field.h |
| index db00e9e7f9efa9951937324cd5c462551d5d7a99..5c091dd97d97f491e4c0190979a07660f356bea1 100644 |
| --- a/chrome/browser/autofill/form_field.h |
| +++ b/chrome/browser/autofill/form_field.h |
| @@ -32,9 +32,21 @@ class FormField { |
| protected: |
| // A bit-field used for matching specific parts of a field in question. |
| enum MatchType { |
| - MATCH_LABEL = 1 << 0, |
| - MATCH_NAME = 1 << 1, |
| - MATCH_ALL = MATCH_LABEL | MATCH_NAME |
| + // Attributes. |
| + MATCH_LABEL = 1 << 0, |
| + MATCH_NAME = 1 << 1, |
| + |
| + // Input types. |
| + MATCH_TEXT = 1 << 2, |
| + MATCH_EMAIL = 1 << 3, |
| + MATCH_MONTH = 1 << 4, |
| + MATCH_TELEPHONE = 1 << 5, |
| + MATCH_SELECT = 1 << 6, |
| + MATCH_ALL_INPUTS = MATCH_TEXT | MATCH_EMAIL | MATCH_MONTH | |
| + MATCH_TELEPHONE | MATCH_SELECT, |
|
Ilya Sherman
2011/05/25 03:52:02
nit: This alignment looks off.
dhollowa
2011/05/25 15:29:47
Done.
|
| + |
| + // By default match label, name, for input/text types. |
| + MATCH_DEFAULT = MATCH_LABEL | MATCH_NAME | MATCH_TEXT, |
| }; |
| // Only derived classes may instantiate. |
| @@ -75,6 +87,15 @@ class FormField { |
| private: |
| FRIEND_TEST_ALL_PREFIXES(FormFieldTest, Match); |
| + // Matches |pattern| to the contents of the field at the head of the |
| + // |scanner|. |
| + // Returns |true| if a match is found according to |match_type|, and |false| |
| + // otherwise. |
| + static bool MatchAndAdvance(AutofillScanner* scanner, |
| + const string16& pattern, |
| + int match_type, |
| + const AutofillField** match); |
|
Ilya Sherman
2011/05/25 03:52:02
nit: Can this be moved to the implementation file?
dhollowa
2011/05/25 15:29:47
This needs to call private method |Match| (which i
Ilya Sherman
2011/05/25 19:17:28
Ah, ok.
|
| + |
| // Matches the regular expression |pattern| against the components of |field| |
| // as specified in the |match_type| bit field (see |MatchType|). |
| static bool Match(const AutofillField* field, |