OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/autofill/data_model_wrapper.h" | 5 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 bool DataModelWrapper::GetDisplayText( | 50 bool DataModelWrapper::GetDisplayText( |
51 base::string16* vertically_compact, | 51 base::string16* vertically_compact, |
52 base::string16* horizontally_compact) { | 52 base::string16* horizontally_compact) { |
53 base::string16 phone = | 53 base::string16 phone = |
54 GetInfoForDisplay(AutofillType(PHONE_HOME_WHOLE_NUMBER)); | 54 GetInfoForDisplay(AutofillType(PHONE_HOME_WHOLE_NUMBER)); |
55 if (phone.empty()) | 55 if (phone.empty()) |
56 return false; | 56 return false; |
57 | 57 |
58 // Format the address. | 58 // Format the address. |
59 scoped_ptr< ::i18n::addressinput::AddressData> address_data = | 59 std::unique_ptr<::i18n::addressinput::AddressData> address_data = |
60 i18n::CreateAddressData( | 60 i18n::CreateAddressData( |
61 base::Bind(&DataModelWrapper::GetInfo, base::Unretained(this))); | 61 base::Bind(&DataModelWrapper::GetInfo, base::Unretained(this))); |
62 address_data->language_code = GetLanguageCode(); | 62 address_data->language_code = GetLanguageCode(); |
63 // Interactive autofill dialog does not display organization field. | 63 // Interactive autofill dialog does not display organization field. |
64 address_data->organization.clear(); | 64 address_data->organization.clear(); |
65 std::vector<std::string> lines; | 65 std::vector<std::string> lines; |
66 ::i18n::addressinput::GetFormattedNationalAddress(*address_data, &lines); | 66 ::i18n::addressinput::GetFormattedNationalAddress(*address_data, &lines); |
67 | 67 |
68 std::string single_line; | 68 std::string single_line; |
69 ::i18n::addressinput::GetFormattedNationalAddressLine( | 69 ::i18n::addressinput::GetFormattedNationalAddressLine( |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 223 } |
224 | 224 |
225 return base::UTF8ToUTF16(address_->GetFieldValue(field)); | 225 return base::UTF8ToUTF16(address_->GetFieldValue(field)); |
226 } | 226 } |
227 | 227 |
228 const std::string& I18nAddressDataWrapper::GetLanguageCode() const { | 228 const std::string& I18nAddressDataWrapper::GetLanguageCode() const { |
229 return address_->language_code; | 229 return address_->language_code; |
230 } | 230 } |
231 | 231 |
232 } // namespace autofill | 232 } // namespace autofill |
OLD | NEW |