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

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

Issue 545175: Add the ability to save and remove AutoFill profiles from the AutoFillDialog.... (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
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/autofill_profile.h" 5 #include "chrome/browser/autofill/autofill_profile.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ADDRESS_HOME_LINE2, 137 ADDRESS_HOME_LINE2,
138 ADDRESS_HOME_CITY, 138 ADDRESS_HOME_CITY,
139 ADDRESS_HOME_STATE, 139 ADDRESS_HOME_STATE,
140 ADDRESS_HOME_ZIP, 140 ADDRESS_HOME_ZIP,
141 ADDRESS_HOME_COUNTRY, 141 ADDRESS_HOME_COUNTRY,
142 PHONE_HOME_NUMBER, 142 PHONE_HOME_NUMBER,
143 PHONE_FAX_NUMBER }; 143 PHONE_FAX_NUMBER };
144 144
145 if (label_ != profile.label_ || 145 if (label_ != profile.label_ ||
146 unique_id_ != profile.unique_id_ || 146 unique_id_ != profile.unique_id_ ||
147 use_billing_address_ != profile.use_billing_address_) 147 use_billing_address_ != profile.use_billing_address_) {
148 return false; 148 return false;
149 }
149 150
150 for (size_t index = 0; index < arraysize(types); ++index) { 151 for (size_t index = 0; index < arraysize(types); ++index) {
151 if (GetFieldText(AutoFillType(types[index])) != 152 if (GetFieldText(AutoFillType(types[index])) !=
152 profile.GetFieldText(AutoFillType(types[index]))) 153 profile.GetFieldText(AutoFillType(types[index])))
153 return false; 154 return false;
154 } 155 }
155 156
156 return true; 157 return true;
157 } 158 }
158 159
(...skipping 17 matching lines...) Expand all
176 use_billing_address_ = use; 177 use_billing_address_ = use;
177 } 178 }
178 179
179 Address* AutoFillProfile::GetBillingAddress() { 180 Address* AutoFillProfile::GetBillingAddress() {
180 return static_cast<Address*>(personal_info_[AutoFillType::ADDRESS_BILLING]); 181 return static_cast<Address*>(personal_info_[AutoFillType::ADDRESS_BILLING]);
181 } 182 }
182 183
183 Address* AutoFillProfile::GetHomeAddress() { 184 Address* AutoFillProfile::GetHomeAddress() {
184 return static_cast<Address*>(personal_info_[AutoFillType::ADDRESS_HOME]); 185 return static_cast<Address*>(personal_info_[AutoFillType::ADDRESS_HOME]);
185 } 186 }
187
188 // So we can compare AutoFillProfiles with EXPECT_EQ().
189 std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile) {
190 return os
191 << UTF16ToASCII(profile.Label())
192 << " "
193 << profile.unique_id()
194 << " "
195 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_FIRST)))
196 << " "
197 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_MIDDLE)))
198 << " "
199 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_LAST)))
200 << " "
201 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(EMAIL_ADDRESS)))
202 << " "
203 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(COMPANY_NAME)))
204 << " "
205 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1)))
206 << " "
207 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2)))
208 << " "
209 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY)))
210 << " "
211 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE)))
212 << " "
213 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP)))
214 << " "
215 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)))
216 << " "
217 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(
218 PHONE_HOME_WHOLE_NUMBER)))
219 << " "
220 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(
221 PHONE_FAX_WHOLE_NUMBER)));
222 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_profile.h ('k') | chrome/browser/autofill/personal_data_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698