Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: components/autofill/core/browser/autofill_address_util.cc

Issue 2889163002: Remove raw DictionaryValue::Set in //components (Closed)
Patch Set: Nits Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/logging.h" 10 #include "base/logging.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // An ordered list of options to show in the <select>. 164 // An ordered list of options to show in the <select>.
165 std::unique_ptr<base::ListValue> country_list(new base::ListValue()); 165 std::unique_ptr<base::ListValue> country_list(new base::ListValue());
166 for (size_t i = 0; i < countries.size(); ++i) { 166 for (size_t i = 0; i < countries.size(); ++i) {
167 std::unique_ptr<base::DictionaryValue> option_details( 167 std::unique_ptr<base::DictionaryValue> option_details(
168 new base::DictionaryValue()); 168 new base::DictionaryValue());
169 option_details->SetString("name", model.GetItemAt(i)); 169 option_details->SetString("name", model.GetItemAt(i));
170 option_details->SetString( 170 option_details->SetString(
171 "value", countries[i] ? countries[i]->country_code() : "separator"); 171 "value", countries[i] ? countries[i]->country_code() : "separator");
172 country_list->Append(std::move(option_details)); 172 country_list->Append(std::move(option_details));
173 } 173 }
174 localized_strings->Set("autofillCountrySelectList", country_list.release()); 174 localized_strings->Set("autofillCountrySelectList", std::move(country_list));
175 175
176 std::unique_ptr<base::ListValue> default_country_components( 176 std::unique_ptr<base::ListValue> default_country_components(
177 new base::ListValue); 177 new base::ListValue);
178 std::string default_country_language_code; 178 std::string default_country_language_code;
179 GetAddressComponents(countries.front()->country_code(), ui_language_code, 179 GetAddressComponents(countries.front()->country_code(), ui_language_code,
180 default_country_components.get(), 180 default_country_components.get(),
181 &default_country_language_code); 181 &default_country_language_code);
182 localized_strings->Set("autofillDefaultCountryComponents", 182 localized_strings->Set("autofillDefaultCountryComponents",
183 default_country_components.release()); 183 std::move(default_country_components));
184 localized_strings->SetString("autofillDefaultCountryLanguageCode", 184 localized_strings->SetString("autofillDefaultCountryLanguageCode",
185 default_country_language_code); 185 default_country_language_code);
186 } 186 }
187 187
188 } // namespace autofill 188 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_html_writer.cc ('k') | components/bookmarks/browser/bookmark_codec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698