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

Unified Diff: components/autofill/core/browser/phone_number.cc

Issue 22040002: [Autofill] Add a separate enumeration for HTML field type hints. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add docs Created 7 years, 5 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: components/autofill/core/browser/phone_number.cc
diff --git a/components/autofill/core/browser/phone_number.cc b/components/autofill/core/browser/phone_number.cc
index a7357d69ead0c3f2f538d6d3781ad7871f83b2a3..970946f5367fd905f16a636f994bbb72c2e41e4d 100644
--- a/components/autofill/core/browser/phone_number.cc
+++ b/components/autofill/core/browser/phone_number.cc
@@ -74,8 +74,8 @@ void PhoneNumber::GetSupportedTypes(NativeFieldTypeSet* supported_types) const {
}
base::string16 PhoneNumber::GetRawInfo(NativeFieldType type) const {
- type = AutofillType::GetEquivalentFieldType(type);
- if (type == PHONE_HOME_WHOLE_NUMBER)
+ // TODO(isherman): Is GetEquivalentNativeType even necessary?
+ if (AutofillType(type).GetEquivalentNativeType() == PHONE_HOME_WHOLE_NUMBER)
return number_;
// Only the whole number is available as raw data. All of the other types are
@@ -86,9 +86,9 @@ base::string16 PhoneNumber::GetRawInfo(NativeFieldType type) const {
void PhoneNumber::SetRawInfo(NativeFieldType type,
const base::string16& value) {
- type = AutofillType::GetEquivalentFieldType(type);
- if (type != PHONE_HOME_CITY_AND_NUMBER &&
- type != PHONE_HOME_WHOLE_NUMBER) {
+ // TODO(isherman): Is GetEquivalentNativeType even necessary?
+ type = AutofillType(type).GetEquivalentNativeType();
+ if (type != PHONE_HOME_CITY_AND_NUMBER && type != PHONE_HOME_WHOLE_NUMBER) {
// Only full phone numbers should be set directly. The remaining field
// field types are read-only.
return;
@@ -106,8 +106,7 @@ void PhoneNumber::SetRawInfo(NativeFieldType type,
// If the phone cannot be normalized, returns the stored value verbatim.
base::string16 PhoneNumber::GetInfo(const AutofillType& type,
const std::string& app_locale) const {
- NativeFieldType native_type =
- AutofillType::GetEquivalentFieldType(type.native_type());
+ NativeFieldType native_type = type.GetEquivalentNativeType();
UpdateCacheIfNeeded(app_locale);
// Queries for whole numbers will return the non-normalized number if
@@ -143,8 +142,7 @@ base::string16 PhoneNumber::GetInfo(const AutofillType& type,
bool PhoneNumber::SetInfo(const AutofillType& type,
const base::string16& value,
const std::string& app_locale) {
- NativeFieldType native_type =
- AutofillType::GetEquivalentFieldType(type.native_type());
+ NativeFieldType native_type = type.GetEquivalentNativeType();
SetRawInfo(native_type, value);
if (number_.empty())
@@ -196,10 +194,9 @@ PhoneNumber::PhoneCombineHelper::PhoneCombineHelper() {
PhoneNumber::PhoneCombineHelper::~PhoneCombineHelper() {
}
-bool PhoneNumber::PhoneCombineHelper::SetInfo(const AutofillType& field_type,
+bool PhoneNumber::PhoneCombineHelper::SetInfo(const AutofillType& type,
const base::string16& value) {
- NativeFieldType native_field_type =
- AutofillType::GetEquivalentFieldType(field_type.native_type());
+ NativeFieldType native_field_type = type.GetEquivalentNativeType();
if (native_field_type == PHONE_HOME_COUNTRY_CODE) {
country_ = value;
return true;

Powered by Google App Engine
This is Rietveld 408576698