OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 void AutoFillProfile::SetInfo(const AutoFillType& type, const string16& value) { | 141 void AutoFillProfile::SetInfo(const AutoFillType& type, const string16& value) { |
142 FormGroupMap::const_iterator iter = personal_info_.find(type.group()); | 142 FormGroupMap::const_iterator iter = personal_info_.find(type.group()); |
143 if (iter == personal_info_.end() || iter->second == NULL) | 143 if (iter == personal_info_.end() || iter->second == NULL) |
144 return; | 144 return; |
145 | 145 |
146 iter->second->SetInfo(type, CollapseWhitespace(value, false)); | 146 iter->second->SetInfo(type, CollapseWhitespace(value, false)); |
147 } | 147 } |
148 | 148 |
149 FormGroup* AutoFillProfile::Clone() const { | 149 FormGroup* AutoFillProfile::Clone() const { |
150 AutoFillProfile* profile = new AutoFillProfile(); | 150 return new AutoFillProfile(*this); |
151 profile->label_ = label_; | |
152 profile->guid_ = guid(); | |
153 | |
154 FormGroupMap::const_iterator iter; | |
155 for (iter = personal_info_.begin(); iter != personal_info_.end(); ++iter) { | |
156 if (profile->personal_info_.count(iter->first)) | |
157 delete profile->personal_info_[iter->first]; | |
158 profile->personal_info_[iter->first] = iter->second->Clone(); | |
159 } | |
160 | |
161 return profile; | |
162 } | 151 } |
163 | 152 |
164 const string16 AutoFillProfile::Label() const { | 153 const string16 AutoFillProfile::Label() const { |
165 return label_; | 154 return label_; |
166 } | 155 } |
167 | 156 |
168 // static | 157 // static |
169 bool AutoFillProfile::AdjustInferredLabels( | 158 bool AutoFillProfile::AdjustInferredLabels( |
170 std::vector<AutoFillProfile*>* profiles) { | 159 std::vector<AutoFillProfile*>* profiles) { |
171 std::vector<string16> created_labels; | 160 std::vector<string16> created_labels; |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP))) | 484 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP))) |
496 << " " | 485 << " " |
497 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY))) | 486 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY))) |
498 << " " | 487 << " " |
499 << UTF16ToUTF8(profile.GetFieldText(AutoFillType( | 488 << UTF16ToUTF8(profile.GetFieldText(AutoFillType( |
500 PHONE_HOME_WHOLE_NUMBER))) | 489 PHONE_HOME_WHOLE_NUMBER))) |
501 << " " | 490 << " " |
502 << UTF16ToUTF8(profile.GetFieldText(AutoFillType( | 491 << UTF16ToUTF8(profile.GetFieldText(AutoFillType( |
503 PHONE_FAX_WHOLE_NUMBER))); | 492 PHONE_FAX_WHOLE_NUMBER))); |
504 } | 493 } |
OLD | NEW |