| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/autofill_address_util.h" | 5 #include "components/autofill/core/browser/autofill_address_util.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // An ordered list of options to show in the <select>. | 141 // An ordered list of options to show in the <select>. |
| 142 std::unique_ptr<base::ListValue> country_list(new base::ListValue()); | 142 std::unique_ptr<base::ListValue> country_list(new base::ListValue()); |
| 143 for (size_t i = 0; i < countries.size(); ++i) { | 143 for (size_t i = 0; i < countries.size(); ++i) { |
| 144 std::unique_ptr<base::DictionaryValue> option_details( | 144 std::unique_ptr<base::DictionaryValue> option_details( |
| 145 new base::DictionaryValue()); | 145 new base::DictionaryValue()); |
| 146 option_details->SetString("name", model.GetItemAt(i)); | 146 option_details->SetString("name", model.GetItemAt(i)); |
| 147 option_details->SetString( | 147 option_details->SetString( |
| 148 "value", countries[i] ? countries[i]->country_code() : "separator"); | 148 "value", countries[i] ? countries[i]->country_code() : "separator"); |
| 149 country_list->Append(std::move(option_details)); | 149 country_list->Append(std::move(option_details)); |
| 150 } | 150 } |
| 151 localized_strings->Set("autofillCountrySelectList", country_list.release()); | 151 localized_strings->Set("autofillCountrySelectList", std::move(country_list)); |
| 152 | 152 |
| 153 std::unique_ptr<base::ListValue> default_country_components( | 153 std::unique_ptr<base::ListValue> default_country_components( |
| 154 new base::ListValue); | 154 new base::ListValue); |
| 155 std::string default_country_language_code; | 155 std::string default_country_language_code; |
| 156 GetAddressComponents(countries.front()->country_code(), ui_language_code, | 156 GetAddressComponents(countries.front()->country_code(), ui_language_code, |
| 157 default_country_components.get(), | 157 default_country_components.get(), |
| 158 &default_country_language_code); | 158 &default_country_language_code); |
| 159 localized_strings->Set("autofillDefaultCountryComponents", | 159 localized_strings->Set("autofillDefaultCountryComponents", |
| 160 default_country_components.release()); | 160 std::move(default_country_components)); |
| 161 localized_strings->SetString("autofillDefaultCountryLanguageCode", | 161 localized_strings->SetString("autofillDefaultCountryLanguageCode", |
| 162 default_country_language_code); | 162 default_country_language_code); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace autofill | 165 } // namespace autofill |
| OLD | NEW |