summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 21:14:53 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 21:14:53 +0000
commit7e08009603d63ce4ff7914a3b984c7b9c99c0556 (patch)
tree4bb6c99d27e59db27db1c300d2648bdcd404a8d8 /chrome/browser
parenteb39d5b4208b4fe3d83da55dc47be03bdc7b68ba (diff)
downloadchromium_src-7e08009603d63ce4ff7914a3b984c7b9c99c0556.zip
chromium_src-7e08009603d63ce4ff7914a3b984c7b9c99c0556.tar.gz
chromium_src-7e08009603d63ce4ff7914a3b984c7b9c99c0556.tar.bz2
Fix a few pieces of the heuristic autofill:
* Escape a parenthesis. * Add firstname, lastname to the regular expressions for first and last name fields. * Compare the result of WebRegularExpression.match to -1 to mean not found. BUG=none TEST=none Review URL: http://codereview.chromium.org/530006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/autofill/form_field.cc4
-rw-r--r--chrome/browser/autofill/name_field.cc6
-rw-r--r--chrome/browser/autofill/phone_field.cc2
3 files changed, 7 insertions, 5 deletions
diff --git a/chrome/browser/autofill/form_field.cc b/chrome/browser/autofill/form_field.cc
index 4d4c76f..2ebcb59 100644
--- a/chrome/browser/autofill/form_field.cc
+++ b/chrome/browser/autofill/form_field.cc
@@ -52,8 +52,8 @@ bool FormField::Match(AutoFillField* field, const string16& pattern) {
// For now, we apply the same pattern to the field's label and the field's
// name. Matching the name is a bit of a long shot for many patterns, but
// it generally doesn't hurt to try.
- if (re.match(WebKit::WebString(field->label())) ||
- re.match(WebKit::WebString(field->name()))) {
+ if (re.match(WebKit::WebString(field->label())) != -1 ||
+ re.match(WebKit::WebString(field->name())) != -1) {
return true;
}
diff --git a/chrome/browser/autofill/name_field.cc b/chrome/browser/autofill/name_field.cc
index 8a32dd6..83f5b16 100644
--- a/chrome/browser/autofill/name_field.cc
+++ b/chrome/browser/autofill/name_field.cc
@@ -72,7 +72,8 @@ FirstLastNameField* FirstLastNameField::Parse2(
// asks, in stuffy English style, for just initials and a surname,
// so we match "initials" here (and just fill in a first name there,
// American-style).
- if (!ParseText(&q, ASCIIToUTF16("first name|initials|fname"), &v.first_name_))
+ if (!ParseText(&q, ASCIIToUTF16("first name|firstname|initials|fname"),
+ &v.first_name_))
return NULL;
// We check for a middle initial before checking for a middle name
@@ -86,7 +87,8 @@ FirstLastNameField* FirstLastNameField::Parse2(
ParseText(&q, ASCIIToUTF16("middle name|mname"), &v.middle_name_);
}
- if (!ParseText(&q, ASCIIToUTF16("last name|lname|surname"), &v.last_name_))
+ if (!ParseText(&q, ASCIIToUTF16("last name|lastname|lname|surname"),
+ &v.last_name_))
return NULL;
*iter = q;
diff --git a/chrome/browser/autofill/phone_field.cc b/chrome/browser/autofill/phone_field.cc
index d0963408..00ff7ba 100644
--- a/chrome/browser/autofill/phone_field.cc
+++ b/chrome/browser/autofill/phone_field.cc
@@ -42,7 +42,7 @@ PhoneField* PhoneField::Parse(std::vector<AutoFillField*>::const_iterator* iter,
// uk/Furniture123-1.html) have several phone numbers in succession and we
// don't want those to be parsed as components of a single phone number.
if (phone2 == NULL)
- ParseText(&q, ASCIIToUTF16("^-|)|"), &phone2);
+ ParseText(&q, ASCIIToUTF16("^-|\\)|"), &phone2);
// Look for a third text box.
if (phone2)