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

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

Issue 517054: Remove all uses of EmptyString16(), EmptyWString(), and EmptyGURL(), and thei... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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
« no previous file with comments | « chrome/browser/autofill/address.cc ('k') | chrome/browser/autofill/credit_card.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/autofill/autofill_type.h" 9 #include "chrome/browser/autofill/autofill_type.h"
10 #include "chrome/browser/autofill/field_types.h" 10 #include "chrome/browser/autofill/field_types.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 if (field_type == NAME_FIRST) 77 if (field_type == NAME_FIRST)
78 return first(); 78 return first();
79 79
80 if (field_type == NAME_MIDDLE) 80 if (field_type == NAME_MIDDLE)
81 return middle(); 81 return middle();
82 82
83 if (field_type == NAME_LAST) 83 if (field_type == NAME_LAST)
84 return last(); 84 return last();
85 85
86 if (field_type == NAME_MIDDLE_INITIAL) 86 if (field_type == NAME_MIDDLE_INITIAL)
87 MiddleInitial(); 87 return MiddleInitial();
88 88
89 if (field_type == NAME_FULL) 89 if (field_type == NAME_FULL)
90 return FullName(); 90 return FullName();
91 91
92 if (field_type == NAME_SUFFIX) 92 if (field_type == NAME_SUFFIX)
93 return suffix(); 93 return suffix();
94 94
95 if (field_type == EMAIL_ADDRESS) 95 if (field_type == EMAIL_ADDRESS)
96 return email(); 96 return email();
97 97
98 if (field_type == COMPANY_NAME) 98 if (field_type == COMPANY_NAME)
99 return company_name(); 99 return company_name();
100 100
101 return EmptyString16(); 101 return string16();
102 } 102 }
103 103
104 void ContactInfo::SetInfo(const AutoFillType& type, const string16& value) { 104 void ContactInfo::SetInfo(const AutoFillType& type, const string16& value) {
105 AutoFillFieldType field_type = type.field_type(); 105 AutoFillFieldType field_type = type.field_type();
106 DCHECK(type.group() == AutoFillType::CONTACT_INFO); 106 DCHECK(type.group() == AutoFillType::CONTACT_INFO);
107 if (field_type == NAME_FIRST) 107 if (field_type == NAME_FIRST)
108 SetFirst(value); 108 SetFirst(value);
109 else if (field_type == NAME_MIDDLE) 109 else if (field_type == NAME_MIDDLE)
110 SetMiddle(value); 110 SetMiddle(value);
111 else if (field_type == NAME_LAST) 111 else if (field_type == NAME_LAST)
112 SetLast(value); 112 SetLast(value);
113 else if (field_type == NAME_SUFFIX) 113 else if (field_type == NAME_SUFFIX)
114 set_suffix(value); 114 set_suffix(value);
115 else if (field_type == EMAIL_ADDRESS) 115 else if (field_type == EMAIL_ADDRESS)
116 email_ = value; 116 email_ = value;
117 else if (field_type == COMPANY_NAME) 117 else if (field_type == COMPANY_NAME)
118 company_name_ = value; 118 company_name_ = value;
119 else 119 else
120 NOTREACHED(); 120 NOTREACHED();
121 } 121 }
122 122
123 string16 ContactInfo::FullName() const { 123 string16 ContactInfo::FullName() const {
124 if (first_.empty()) 124 if (first_.empty())
125 return EmptyString16(); 125 return string16();
126 126
127 std::vector<string16> full_name; 127 std::vector<string16> full_name;
128 full_name.push_back(first_); 128 full_name.push_back(first_);
129 129
130 if (!middle_.empty()) 130 if (!middle_.empty())
131 full_name.push_back(middle_); 131 full_name.push_back(middle_);
132 132
133 if (!last_.empty()) 133 if (!last_.empty())
134 full_name.push_back(last_); 134 full_name.push_back(last_);
135 135
136 if (!suffix_.empty()) 136 if (!suffix_.empty())
137 full_name.push_back(suffix_); 137 full_name.push_back(suffix_);
138 138
139 return JoinString(full_name, ' '); 139 return JoinString(full_name, ' ');
140 } 140 }
141 141
142 string16 ContactInfo::MiddleInitial() const { 142 string16 ContactInfo::MiddleInitial() const {
143 if (middle_.empty()) 143 if (middle_.empty())
144 return EmptyString16(); 144 return string16();
145 145
146 string16 middle_name(middle()); 146 string16 middle_name(middle());
147 string16 initial; 147 string16 initial;
148 initial.push_back(middle_name[0]); 148 initial.push_back(middle_name[0]);
149 return initial; 149 return initial;
150 } 150 }
151 151
152 ContactInfo::ContactInfo(const ContactInfo& contact_info) 152 ContactInfo::ContactInfo(const ContactInfo& contact_info)
153 : first_tokens_(contact_info.first_tokens_), 153 : first_tokens_(contact_info.first_tokens_),
154 middle_tokens_(contact_info.middle_tokens_), 154 middle_tokens_(contact_info.middle_tokens_),
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 348 }
349 349
350 void ContactInfo::SetLast(const string16& last) { 350 void ContactInfo::SetLast(const string16& last) {
351 last_ = last; 351 last_ = last;
352 last_tokens_.clear(); 352 last_tokens_.clear();
353 Tokenize(last, kNameSplitChars, &last_tokens_); 353 Tokenize(last, kNameSplitChars, &last_tokens_);
354 NameTokens::iterator iter; 354 NameTokens::iterator iter;
355 for (iter = last_tokens_.begin(); iter != last_tokens_.end(); ++iter) 355 for (iter = last_tokens_.begin(); iter != last_tokens_.end(); ++iter)
356 *iter = StringToLowerASCII(*iter); 356 *iter = StringToLowerASCII(*iter);
357 } 357 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/address.cc ('k') | chrome/browser/autofill/credit_card.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698