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

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

Issue 7892048: Autofill: Remove fax number completely. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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: chrome/browser/autofill/phone_field.cc
diff --git a/chrome/browser/autofill/phone_field.cc b/chrome/browser/autofill/phone_field.cc
index c285508b0f54c68c7e19005e15028910bd53e802..ca321211c7ff5b688b801b38f718e77d7da80eb1 100644
--- a/chrome/browser/autofill/phone_field.cc
+++ b/chrome/browser/autofill/phone_field.cc
@@ -11,7 +11,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_field.h"
#include "chrome/browser/autofill/autofill_scanner.h"
-#include "chrome/browser/autofill/fax_number.h"
#include "chrome/browser/autofill/home_phone_number.h"
#include "ui/base/l10n/l10n_util.h"
@@ -45,20 +44,6 @@ const char kAreaCodeRe[] =
"area.*code|acode|area"
// ko-KR
"|\xec\xa7\x80\xec\x97\xad.?\xeb\xb2\x88\xed\x98\xb8";
-const char kFaxRe[] =
- "fax"
- // fr-FR
- "|t\xc3\xa9l\xc3\xa9""copie|telecopie"
- // ja-JP
- "|\xe3\x83\x95\xe3\x82\xa1\xe3\x83\x83\xe3\x82\xaf\xe3\x82\xb9"
- // ru
- "|\xd1\x84\xd0\xb0\xd0\xba\xd1\x81"
- // zh-CN
- "|\xe4\xbc\xa0\xe7\x9c\x9f"
- // zh-TW
- "|\xe5\x82\xb3\xe7\x9c\x9f"
- // ko-KR
- "|\xed\x8c\xa9\xec\x8a\xa4(.?\xeb\xb2\x88\xed\x98\xb8)?";
const char kPhonePrefixSeparatorRe[] =
"^-$|^\\)$";
const char kPhoneSuffixSeparatorRe[] =
@@ -174,22 +159,15 @@ FormField* PhoneField::Parse(AutofillScanner* scanner) {
return NULL;
scoped_ptr<PhoneField> phone_field(new PhoneField);
-
- // Go through the phones in order HOME, FAX, attempting to match. HOME should
- // be the last as it is a catch all case ("fax" and "faxarea" parsed as FAX,
- // but "area" and "someotherarea" parsed as HOME, for example).
- for (int i = PHONE_TYPE_MAX - 1; i >= PHONE_TYPE_FIRST; --i) {
- phone_field->SetPhoneType(static_cast<PhoneField::PhoneType>(i));
- if (ParseInternal(phone_field.get(), scanner, i == HOME_PHONE))
- return phone_field.release();
- }
+ if (ParseInternal(phone_field.get(), scanner))
+ return phone_field.release();
return NULL;
}
PhoneField::PhoneField() {
memset(parsed_phone_fields_, 0, sizeof(parsed_phone_fields_));
- SetPhoneType(HOME_PHONE);
+ number_.reset(new PhoneNumber(AutofillType::PHONE_HOME, NULL));
}
bool PhoneField::ClassifyField(FieldTypeMap* map) const {
@@ -238,12 +216,10 @@ bool PhoneField::ClassifyField(FieldTypeMap* map) const {
}
string16 PhoneField::GetCountryRegex() const {
- // This one is the same for Home and Fax numbers.
return UTF8ToUTF16(kCountryCodeRe);
}
string16 PhoneField::GetAreaRegex() const {
- // This one is the same for Home and Fax numbers.
string16 area_code = UTF8ToUTF16(kAreaCodeRe);
area_code.append(ASCIIToUTF16("|")); // Regexp separator.
area_code.append(GetAreaNoTextRegex());
@@ -251,42 +227,30 @@ string16 PhoneField::GetAreaRegex() const {
}
string16 PhoneField::GetAreaNoTextRegex() const {
- // This one is the same for Home and Fax numbers.
return UTF8ToUTF16(kAreaCodeNotextRe);
}
string16 PhoneField::GetPhoneRegex() const {
- if (phone_type_ == HOME_PHONE)
- return UTF8ToUTF16(kPhoneRe);
- else if (phone_type_ == FAX_PHONE)
- return UTF8ToUTF16(kFaxRe);
- else
- NOTREACHED();
- return string16();
+ return UTF8ToUTF16(kPhoneRe);
}
string16 PhoneField::GetPrefixSeparatorRegex() const {
- // This one is the same for Home and Fax numbers.
return UTF8ToUTF16(kPhonePrefixSeparatorRe);
}
string16 PhoneField::GetPrefixRegex() const {
- // This one is the same for Home and Fax numbers.
return UTF8ToUTF16(kPhonePrefixRe);
}
string16 PhoneField::GetSuffixSeparatorRegex() const {
- // This one is the same for Home and Fax numbers.
return UTF8ToUTF16(kPhoneSuffixSeparatorRe);
}
string16 PhoneField::GetSuffixRegex() const {
- // This one is the same for Home and Fax numbers.
return UTF8ToUTF16(kPhoneSuffixRe);
}
string16 PhoneField::GetExtensionRegex() const {
- // This one is the same for Home and Fax numbers.
return UTF8ToUTF16(kPhoneExtensionRe);
}
@@ -310,8 +274,7 @@ string16 PhoneField::GetRegExp(RegexType regex_id) const {
// static
bool PhoneField::ParseInternal(PhoneField *phone_field,
- AutofillScanner* scanner,
- bool regular_phone) {
+ AutofillScanner* scanner) {
DCHECK(phone_field);
scanner->SaveCursor();
@@ -385,14 +348,3 @@ bool PhoneField::ParseInternal(PhoneField *phone_field,
return true;
}
-
-void PhoneField::SetPhoneType(PhoneType phone_type) {
- // Field types are different as well, so we create a temporary phone number,
- // to get relevant field types.
- if (phone_type == HOME_PHONE)
- number_.reset(new PhoneNumber(AutofillType::PHONE_HOME, NULL));
- else
- number_.reset(new PhoneNumber(AutofillType::PHONE_FAX, NULL));
- phone_type_ = phone_type;
-}
-

Powered by Google App Engine
This is Rietveld 408576698