Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/autofill/core/browser/address_i18n.h" | 5 #include "components/autofill/core/browser/address_i18n.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 address_data->administrative_area = base::UTF16ToUTF8( | 41 address_data->administrative_area = base::UTF16ToUTF8( |
| 42 get_info.Run(AutofillType(ADDRESS_HOME_STATE))); | 42 get_info.Run(AutofillType(ADDRESS_HOME_STATE))); |
| 43 address_data->locality = base::UTF16ToUTF8( | 43 address_data->locality = base::UTF16ToUTF8( |
| 44 get_info.Run(AutofillType(ADDRESS_HOME_CITY))); | 44 get_info.Run(AutofillType(ADDRESS_HOME_CITY))); |
| 45 address_data->dependent_locality = base::UTF16ToUTF8( | 45 address_data->dependent_locality = base::UTF16ToUTF8( |
| 46 get_info.Run(AutofillType(ADDRESS_HOME_DEPENDENT_LOCALITY))); | 46 get_info.Run(AutofillType(ADDRESS_HOME_DEPENDENT_LOCALITY))); |
| 47 address_data->sorting_code = base::UTF16ToUTF8( | 47 address_data->sorting_code = base::UTF16ToUTF8( |
| 48 get_info.Run(AutofillType(ADDRESS_HOME_SORTING_CODE))); | 48 get_info.Run(AutofillType(ADDRESS_HOME_SORTING_CODE))); |
| 49 address_data->postal_code = base::UTF16ToUTF8( | 49 address_data->postal_code = base::UTF16ToUTF8( |
| 50 get_info.Run(AutofillType(ADDRESS_HOME_ZIP))); | 50 get_info.Run(AutofillType(ADDRESS_HOME_ZIP))); |
| 51 base::SplitString( | 51 address_data->address_line = base::SplitString( |
| 52 base::UTF16ToUTF8( | 52 base::UTF16ToUTF8( |
| 53 get_info.Run(AutofillType(ADDRESS_HOME_STREET_ADDRESS))), | 53 get_info.Run(AutofillType(ADDRESS_HOME_STREET_ADDRESS))), |
| 54 '\n', | 54 "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); |
|
yzshen1
2015/07/22 22:38:23
TRIM_WHITESPACE?
| |
| 55 &address_data->address_line); | |
| 56 return address_data.Pass(); | 55 return address_data.Pass(); |
| 57 } | 56 } |
| 58 | 57 |
| 59 scoped_ptr< ::i18n::addressinput::AddressData> | 58 scoped_ptr< ::i18n::addressinput::AddressData> |
| 60 CreateAddressDataFromAutofillProfile(const AutofillProfile& profile, | 59 CreateAddressDataFromAutofillProfile(const AutofillProfile& profile, |
| 61 const std::string& app_locale) { | 60 const std::string& app_locale) { |
| 62 scoped_ptr< ::i18n::addressinput::AddressData> address_data = | 61 scoped_ptr< ::i18n::addressinput::AddressData> address_data = |
| 63 i18n::CreateAddressData(base::Bind(&GetInfoHelper, profile, app_locale)); | 62 i18n::CreateAddressData(base::Bind(&GetInfoHelper, profile, app_locale)); |
| 64 address_data->language_code = profile.language_code(); | 63 address_data->language_code = profile.language_code(); |
| 65 return address_data.Pass(); | 64 return address_data.Pass(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 if (field) | 141 if (field) |
| 143 *field = ::i18n::addressinput::RECIPIENT; | 142 *field = ::i18n::addressinput::RECIPIENT; |
| 144 return true; | 143 return true; |
| 145 default: | 144 default: |
| 146 return false; | 145 return false; |
| 147 } | 146 } |
| 148 } | 147 } |
| 149 | 148 |
| 150 } // namespace i18n | 149 } // namespace i18n |
| 151 } // namespace autofill | 150 } // namespace autofill |
| OLD | NEW |