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

Unified Diff: chrome/browser/autofill/form_field.h

Issue 7063031: Heuristics for grabber-continental.com.out (select-one) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/email_field.cc ('k') | chrome/browser/autofill/form_field.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9ad8d0d071ab06f94ba3886762bec0e4b5170583 100644
--- a/chrome/browser/autofill/form_field.h
+++ b/chrome/browser/autofill/form_field.h
@@ -32,9 +32,20 @@ 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_TELEPHONE = 1 << 4,
+ MATCH_SELECT = 1 << 5,
+ MATCH_ALL_INPUTS =
+ MATCH_TEXT | MATCH_EMAIL | MATCH_TELEPHONE | MATCH_SELECT,
+
+ // By default match label and name for input/text types.
+ MATCH_DEFAULT = MATCH_LABEL | MATCH_NAME | MATCH_TEXT,
};
// Only derived classes may instantiate.
@@ -75,6 +86,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);
+
// 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,
« no previous file with comments | « chrome/browser/autofill/email_field.cc ('k') | chrome/browser/autofill/form_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698