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 <set> | 8 #include <set> |
9 | 9 |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 193 } |
194 | 194 |
195 FormGroup* AutoFillProfile::Clone() const { | 195 FormGroup* AutoFillProfile::Clone() const { |
196 return new AutoFillProfile(*this); | 196 return new AutoFillProfile(*this); |
197 } | 197 } |
198 | 198 |
199 const string16 AutoFillProfile::Label() const { | 199 const string16 AutoFillProfile::Label() const { |
200 return label_; | 200 return label_; |
201 } | 201 } |
202 | 202 |
| 203 const std::string AutoFillProfile::CountryCode() const { |
| 204 FormGroup* form_group = |
| 205 personal_info_.find(AutoFillType::ADDRESS_HOME)->second; |
| 206 DCHECK(form_group); |
| 207 Address* address = static_cast<Address*>(form_group); |
| 208 return address->country_code(); |
| 209 } |
| 210 |
| 211 void AutoFillProfile::SetCountryCode(const std::string& country_code) { |
| 212 FormGroup* form_group = |
| 213 personal_info_.find(AutoFillType::ADDRESS_HOME)->second; |
| 214 DCHECK(form_group); |
| 215 Address* address = static_cast<Address*>(form_group); |
| 216 address->set_country_code(country_code); |
| 217 } |
| 218 |
203 // static | 219 // static |
204 bool AutoFillProfile::AdjustInferredLabels( | 220 bool AutoFillProfile::AdjustInferredLabels( |
205 std::vector<AutoFillProfile*>* profiles) { | 221 std::vector<AutoFillProfile*>* profiles) { |
206 const size_t kMinimalFieldsShown = 2; | 222 const size_t kMinimalFieldsShown = 2; |
207 | 223 |
208 std::vector<string16> created_labels; | 224 std::vector<string16> created_labels; |
209 CreateInferredLabels(profiles, NULL, UNKNOWN_TYPE, kMinimalFieldsShown, | 225 CreateInferredLabels(profiles, NULL, UNKNOWN_TYPE, kMinimalFieldsShown, |
210 &created_labels); | 226 &created_labels); |
211 DCHECK_EQ(profiles->size(), created_labels.size()); | 227 DCHECK_EQ(profiles->size(), created_labels.size()); |
212 | 228 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP))) | 484 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP))) |
469 << " " | 485 << " " |
470 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY))) | 486 << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY))) |
471 << " " | 487 << " " |
472 << UTF16ToUTF8(profile.GetFieldText(AutoFillType( | 488 << UTF16ToUTF8(profile.GetFieldText(AutoFillType( |
473 PHONE_HOME_WHOLE_NUMBER))) | 489 PHONE_HOME_WHOLE_NUMBER))) |
474 << " " | 490 << " " |
475 << UTF16ToUTF8(profile.GetFieldText(AutoFillType( | 491 << UTF16ToUTF8(profile.GetFieldText(AutoFillType( |
476 PHONE_FAX_WHOLE_NUMBER))); | 492 PHONE_FAX_WHOLE_NUMBER))); |
477 } | 493 } |
OLD | NEW |