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

Unified Diff: components/autofill/core/browser/form_field.h

Issue 1028633004: Autofill: Improve heuristics for city/state/zip fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/form_field.h
diff --git a/components/autofill/core/browser/form_field.h b/components/autofill/core/browser/form_field.h
index e1f4d36b7a138f818f87d282f2b0c40234aeba32..d4e3c20f863360e218ad15c7a7075c98e351b959 100644
--- a/components/autofill/core/browser/form_field.h
+++ b/components/autofill/core/browser/form_field.h
@@ -55,6 +55,13 @@ class FormField {
MATCH_DEFAULT = MATCH_LABEL | MATCH_NAME | MATCH_TEXT,
};
+ enum ParseNameLabelResult {
Evan Stade 2015/03/24 00:04:32 docs
Lei Zhang 2015/03/25 00:42:28 Done.
+ RESULT_MATCH_NONE,
+ RESULT_MATCH_LABEL,
+ RESULT_MATCH_NAME,
+ RESULT_MATCH_NAME_LABEL
+ };
+
// Only derived classes may instantiate.
FormField() {}
@@ -74,6 +81,17 @@ class FormField {
int match_type,
AutofillField** match);
+ // Like ParseFieldSpecifics(), but applies |pattern| against the name and
+ // label of the current field separately. If the return value is
+ // RESULT_MATCH_NAME_LABEL, then |scanner| advances and |match| is filled if
+ // it is non-NULL. Otherwise |scanner| does not advance and |match| does not
+ // change.
+ static ParseNameLabelResult ParseNameAndLabelSeparately(
+ AutofillScanner* scanner,
+ const base::string16& pattern,
+ int match_type,
+ AutofillField** match);
+
// Attempts to parse a field with an empty label. Returns true
// on success and fills |match| with a pointer to the field.
static bool ParseEmptyLabel(AutofillScanner* scanner, AutofillField** match);
@@ -114,6 +132,10 @@ class FormField {
const base::string16& pattern,
int match_type);
+ // Returns |match_type| sans MATCH_LABEL/MATCH_NAME.
+ static int MatchTypeWithoutLabel(int match_type);
+ static int MatchTypeWithoutName(int match_type);
+
// Perform a "pass" over the |fields| where each pass uses the supplied
// |parse| method to match content to a given field type.
// |fields| is both an input and an output parameter. Upon exit |fields|

Powered by Google App Engine
This is Rietveld 408576698