Index: components/autofill/core/browser/contact_info.cc |
diff --git a/components/autofill/core/browser/contact_info.cc b/components/autofill/core/browser/contact_info.cc |
index 202867613b5f57ef4a6b4262af19b87e55da6e40..979434fc564a37c834371a8e0adc7fdf49280fdb 100644 |
--- a/components/autofill/core/browser/contact_info.cc |
+++ b/components/autofill/core/browser/contact_info.cc |
@@ -52,38 +52,53 @@ void NameInfo::GetSupportedTypes(NativeFieldTypeSet* supported_types) const { |
} |
base::string16 NameInfo::GetRawInfo(NativeFieldType type) const { |
- type = AutofillType::GetEquivalentFieldType(type); |
- if (type == NAME_FIRST) |
- return first(); |
+ // TODO(isherman): Is GetEquivalentNativeType even necessary? |
+ switch (AutofillType(type).GetEquivalentNativeType()) { |
+ case NAME_FIRST: |
+ return first(); |
- if (type == NAME_MIDDLE) |
- return middle(); |
+ case NAME_MIDDLE: |
+ return middle(); |
- if (type == NAME_LAST) |
- return last(); |
+ case NAME_LAST: |
+ return last(); |
- if (type == NAME_MIDDLE_INITIAL) |
- return MiddleInitial(); |
+ case NAME_MIDDLE_INITIAL: |
+ return MiddleInitial(); |
- if (type == NAME_FULL) |
- return FullName(); |
+ case NAME_FULL: |
+ return FullName(); |
- return base::string16(); |
+ default: |
+ return base::string16(); |
+ } |
} |
void NameInfo::SetRawInfo(NativeFieldType type, const base::string16& value) { |
- type = AutofillType::GetEquivalentFieldType(type); |
- DCHECK_EQ(NAME, AutofillType(type).group()); |
- if (type == NAME_FIRST) |
- first_ = value; |
- else if (type == NAME_MIDDLE || type == NAME_MIDDLE_INITIAL) |
- middle_ = value; |
- else if (type == NAME_LAST) |
- last_ = value; |
- else if (type == NAME_FULL) |
- SetFullName(value); |
- else |
- NOTREACHED(); |
+ // TODO(isherman): Is GetEquivalentNativeType even necessary? |
+ NativeFieldType native_type = AutofillType(type).GetEquivalentNativeType(); |
+ DCHECK_EQ(NAME, AutofillType(native_type).group()); |
+ switch (native_type) { |
+ case NAME_FIRST: |
+ first_ = value; |
+ break; |
+ |
+ case NAME_MIDDLE: |
+ case NAME_MIDDLE_INITIAL: |
+ middle_ = value; |
+ break; |
+ |
+ case NAME_LAST: |
+ last_ = value; |
+ break; |
+ |
+ case NAME_FULL: |
+ SetFullName(value); |
+ break; |
+ |
+ default: |
+ NOTREACHED(); |
+ } |
} |
base::string16 NameInfo::FullName() const { |