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

Unified Diff: chrome/browser/autofill/phone_field.cc

Issue 6026010: Autofill heuristics regular expressions should be stored in external data files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 10 years 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/name_field.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/phone_field.cc
diff --git a/chrome/browser/autofill/phone_field.cc b/chrome/browser/autofill/phone_field.cc
index e063587cf316fda0c1a6bd88aaae8e270815d8f6..083a8dc757fa8f0869f90cdbdd0453cc12a6c15b 100644
--- a/chrome/browser/autofill/phone_field.cc
+++ b/chrome/browser/autofill/phone_field.cc
@@ -4,12 +4,14 @@
#include "chrome/browser/autofill/phone_field.h"
+#include "app/l10n_util.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_field.h"
+#include "grit/autofill_resources.h"
// static
PhoneField* PhoneField::Parse(std::vector<AutoFillField*>::const_iterator* iter,
@@ -30,13 +32,15 @@ PhoneField* PhoneField::Parse(std::vector<AutoFillField*>::const_iterator* iter,
// Some pages, such as BloomingdalesShipping.html, have a field labeled
// "Area Code and Phone"; we want to parse this as a phone number field so
// we look for "phone" before we look for "area code".
- if (ParseText(&q, ASCIIToUTF16("phone"), &phone)) {
+ if (ParseText(&q, l10n_util::GetStringUTF16(IDS_AUTOFILL_PHONE_RE), &phone)) {
area_code = false;
} else {
- if (!ParseText(&q, ASCIIToUTF16("area code"), &phone))
+ if (!ParseText(&q,
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_AREA_CODE_RE),
+ &phone))
return NULL;
area_code = true;
- ParseText(&q, ASCIIToUTF16("phone"), &phone2);
+ ParseText(&q, l10n_util::GetStringUTF16(IDS_AUTOFILL_PHONE_RE), &phone2);
}
// Sometimes phone number fields are separated by "-" (e.g. test page
@@ -48,11 +52,15 @@ 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("^-$|\\)$|prefix"), &phone2);
+ ParseText(&q,
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_PHONE_PREFIX_RE),
+ &phone2);
// Look for a third text box.
if (phone2)
- ParseText(&q, ASCIIToUTF16("^-$|suffix"), &phone3);
+ ParseText(&q,
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_PHONE_SUFFIX_RE),
+ &phone3);
// Now we have one, two, or three phone number text fields. Package them
// up into a PhoneField object.
@@ -73,7 +81,9 @@ PhoneField* PhoneField::Parse(std::vector<AutoFillField*>::const_iterator* iter,
}
// Now look for an extension.
- ParseText(&q, ASCIIToUTF16("ext"), &phone_field->extension_);
+ ParseText(&q,
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_PHONE_EXTENSION_RE),
+ &phone_field->extension_);
*iter = q;
return phone_field.release();
« no previous file with comments | « chrome/browser/autofill/name_field.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698