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

Side by Side Diff: chrome/browser/autofill/contact_info.cc

Issue 8038064: Autofill: Support 'full names' that are lacking a first or a middle name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/autofill/contact_info.h" 5 #include "chrome/browser/autofill/contact_info.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 middle_ = value; 77 middle_ = value;
78 else if (type == NAME_LAST) 78 else if (type == NAME_LAST)
79 last_ = value; 79 last_ = value;
80 else if (type == NAME_FULL) 80 else if (type == NAME_FULL)
81 SetFullName(value); 81 SetFullName(value);
82 else 82 else
83 NOTREACHED(); 83 NOTREACHED();
84 } 84 }
85 85
86 string16 NameInfo::FullName() const { 86 string16 NameInfo::FullName() const {
87 if (first_.empty())
88 return string16();
89
90 std::vector<string16> full_name; 87 std::vector<string16> full_name;
91 full_name.push_back(first_); 88 if (!first_.empty())
89 full_name.push_back(first_);
92 90
93 if (!middle_.empty()) 91 if (!middle_.empty())
94 full_name.push_back(middle_); 92 full_name.push_back(middle_);
95 93
96 if (!last_.empty()) 94 if (!last_.empty())
97 full_name.push_back(last_); 95 full_name.push_back(last_);
98 96
99 return JoinString(full_name, ' '); 97 return JoinString(full_name, ' ');
100 } 98 }
101 99
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (type == COMPANY_NAME) 187 if (type == COMPANY_NAME)
190 return company_name_; 188 return company_name_;
191 189
192 return string16(); 190 return string16();
193 } 191 }
194 192
195 void CompanyInfo::SetInfo(AutofillFieldType type, const string16& value) { 193 void CompanyInfo::SetInfo(AutofillFieldType type, const string16& value) {
196 DCHECK_EQ(COMPANY_NAME, type); 194 DCHECK_EQ(COMPANY_NAME, type);
197 company_name_ = value; 195 company_name_ = value;
198 } 196 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698