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

Unified Diff: components/autofill/core/browser/contact_info.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: Fix browser test Created 7 years, 4 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/contact_info.cc
diff --git a/components/autofill/core/browser/contact_info.cc b/components/autofill/core/browser/contact_info.cc
index 7ecf44d5aa291bafcc78f32c6f3c022184db0d3a..603c4fa3b54353a82003c240ae3e70f3844cafa4 100644
--- a/components/autofill/core/browser/contact_info.cc
+++ b/components/autofill/core/browser/contact_info.cc
@@ -52,38 +52,53 @@ void NameInfo::GetSupportedTypes(ServerFieldTypeSet* supported_types) const {
}
base::string16 NameInfo::GetRawInfo(ServerFieldType type) const {
- type = AutofillType::GetEquivalentFieldType(type);
- if (type == NAME_FIRST)
- return first();
+ // TODO(isherman): Is GetStorableType even necessary?
+ switch (AutofillType(type).GetStorableType()) {
+ 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(ServerFieldType 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 GetStorableType even necessary?
+ ServerFieldType storable_type = AutofillType(type).GetStorableType();
+ DCHECK_EQ(NAME, AutofillType(storable_type).group());
+ switch (storable_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 {
« no previous file with comments | « components/autofill/core/browser/autofill_type_unittest.cc ('k') | components/autofill/core/browser/credit_card.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698