diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 22:49:04 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 22:49:04 +0000 |
commit | 9913ab8cc18beafd08427e3fd9d4786836e69949 (patch) | |
tree | 218e40aae0b1c721639fc864c67c530a47783a44 /chrome/browser/autofill/form_field.h | |
parent | 9b0df87239c63ac3facc5a7937903b4eddcb31e4 (diff) | |
download | chromium_src-9913ab8cc18beafd08427e3fd9d4786836e69949.zip chromium_src-9913ab8cc18beafd08427e3fd9d4786836e69949.tar.gz chromium_src-9913ab8cc18beafd08427e3fd9d4786836e69949.tar.bz2 |
AutoFill field parser fixes.
This fixes a number of form field parsing issues. Ecml field name matching. Adds country field parsing. Adds state field parsing. Multi-line address parsing. Fixes issue with empty field names confusing the parser. Fixes issue with phone field parsing. Adds unit tests in form_structure_unittest.cc to verify parsing order issues. Adds new unit tests address_field_unittest.cc that cover parsing of each address component as well as Ecml variants.
BUG=37776
TEST=FormStructureTest.Heuristics:AddressFieldTest.*, as well as manual steps described in bug report.
Review URL: http://codereview.chromium.org/867003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/form_field.h')
-rw-r--r-- | chrome/browser/autofill/form_field.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/chrome/browser/autofill/form_field.h b/chrome/browser/autofill/form_field.h index 78d2109..d702719 100644 --- a/chrome/browser/autofill/form_field.h +++ b/chrome/browser/autofill/form_field.h @@ -82,7 +82,10 @@ class FormField { virtual FormFieldType GetFormFieldType() const { return kOtherFieldType; } // Returns true if |field| contains the regexp |pattern| in the name or label. - static bool Match(AutoFillField* field, const string16& pattern); + // If |match_label_only| is true, then only the field's label is considered. + static bool Match(AutoFillField* field, + const string16& pattern, + bool match_label_only); // Parses a field using the different field views we know about. |is_ecml| // should be true when the field conforms to the ECML specification. @@ -101,6 +104,12 @@ class FormField { const string16& pattern, AutoFillField** dest); + // Attempts to parse a text field label with the given pattern. Returns true + // on success and fills |dest| with a pointer to the field. + static bool ParseLabelText(std::vector<AutoFillField*>::const_iterator* iter, + const string16& pattern, + AutoFillField** dest); + // Attempts to parse a control with an empty label. static bool ParseEmpty(std::vector<AutoFillField*>::const_iterator* iter); @@ -120,6 +129,12 @@ class FormField { static string16 GetEcmlPattern(const string16& ecml_name1, const string16& ecml_name2, string16::value_type pattern_operator); + + private: + static bool ParseText(std::vector<AutoFillField*>::const_iterator* iter, + const string16& pattern, + AutoFillField** dest, + bool match_label_only); }; class FormFieldSet : public std::vector<FormField*> { |