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

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

Issue 2673006: AutoFill Profiles dialog implemented according to new mocks on Mac (Closed)
Patch Set: Revisions based on review comments. Created 10 years, 6 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/contact_info.cc
diff --git a/chrome/browser/autofill/contact_info.cc b/chrome/browser/autofill/contact_info.cc
index 8d4a08fdc25fa7f81c4288ae778a74fd58ecdab7..44e878a3bda7775298784dee1515dc46abddd7ee 100644
--- a/chrome/browser/autofill/contact_info.cc
+++ b/chrome/browser/autofill/contact_info.cc
@@ -112,7 +112,27 @@ void ContactInfo::SetInfo(const AutoFillType& type, const string16& value) {
SetLast(value);
else if (field_type == NAME_SUFFIX)
set_suffix(value);
- else if (field_type == EMAIL_ADDRESS)
+ else if (field_type == NAME_FULL) {
+ // TODO(dhollowa): This needs formal spec on how names are split from
+ // unstructured string to structured fields.
+ std::vector<string16> values;
+ SplitStringAlongWhitespace(value, &values);
+ if (values.size() == 1) {
+ SetInfo(AutoFillType(NAME_FIRST), values[0]);
+ } else if (values.size() == 2) {
+ SetInfo(AutoFillType(NAME_FIRST), values[0]);
+ SetInfo(AutoFillType(NAME_LAST), values[1]);
+ } else if (values.size() == 3) {
+ SetInfo(AutoFillType(NAME_FIRST), values[0]);
+ SetInfo(AutoFillType(NAME_MIDDLE), values[1]);
+ SetInfo(AutoFillType(NAME_LAST), values[2]);
+ } else if (values.size() >= 4) {
+ SetInfo(AutoFillType(NAME_FIRST), values[0]);
+ SetInfo(AutoFillType(NAME_MIDDLE), values[1]);
+ SetInfo(AutoFillType(NAME_LAST), values[2]);
+ SetInfo(AutoFillType(NAME_SUFFIX), values[3]);
+ }
+ } else if (field_type == EMAIL_ADDRESS)
email_ = value;
else if (field_type == COMPANY_NAME)
company_name_ = value;
« no previous file with comments | « chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm ('k') | chrome/browser/cocoa/disclosure_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698