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

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: address comment 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
« no previous file with comments | « components/autofill/core/browser/address_field.cc ('k') | components/autofill/core/browser/form_field.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c27dc0896501289068f544ae65f7503bf372710c 100644
--- a/components/autofill/core/browser/form_field.h
+++ b/components/autofill/core/browser/form_field.h
@@ -55,6 +55,14 @@ class FormField {
MATCH_DEFAULT = MATCH_LABEL | MATCH_NAME | MATCH_TEXT,
};
+ // When parsing a field's label and name separately with a given pattern:
+ enum ParseNameLabelResult {
+ RESULT_MATCH_NONE, // No match with the label or name.
+ RESULT_MATCH_LABEL, // Only the label matches the pattern.
+ RESULT_MATCH_NAME, // Only the name matches the pattern.
+ RESULT_MATCH_NAME_LABEL // Name and label both match the pattern.
+ };
+
// Only derived classes may instantiate.
FormField() {}
@@ -74,6 +82,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);
« no previous file with comments | « components/autofill/core/browser/address_field.cc ('k') | components/autofill/core/browser/form_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698