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

Side by Side Diff: chrome/browser/extensions/api/autofill_private/autofill_util.cc

Issue 2705773002: [Autofill] Move country combo box model from chrome to component. (Closed)
Patch Set: Rebase Created 3 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extensions/api/autofill_private/autofill_util.h" 5 #include "chrome/browser/extensions/api/autofill_private/autofill_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector>
10 11
11 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
12 #include "base/strings/string_split.h" 13 #include "base/strings/string_split.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/extensions/api/settings_private/prefs_util.h" 16 #include "chrome/browser/extensions/api/settings_private/prefs_util.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/autofill/country_combobox_model.h"
18 #include "chrome/common/extensions/api/autofill_private.h" 18 #include "chrome/common/extensions/api/autofill_private.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "components/autofill/core/browser/autofill_country.h" 20 #include "components/autofill/core/browser/autofill_country.h"
21 #include "components/autofill/core/browser/autofill_profile.h" 21 #include "components/autofill/core/browser/autofill_profile.h"
22 #include "components/autofill/core/browser/autofill_type.h" 22 #include "components/autofill/core/browser/autofill_type.h"
23 #include "components/autofill/core/browser/country_combobox_model.h"
23 #include "components/autofill/core/browser/credit_card.h" 24 #include "components/autofill/core/browser/credit_card.h"
24 #include "components/autofill/core/browser/field_types.h" 25 #include "components/autofill/core/browser/field_types.h"
25 #include "components/prefs/pref_service.h" 26 #include "components/prefs/pref_service.h"
26 #include "components/strings/grit/components_strings.h" 27 #include "components/strings/grit/components_strings.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
28 29
29 namespace autofill_private = extensions::api::autofill_private; 30 namespace autofill_private = extensions::api::autofill_private;
30 31
31 namespace { 32 namespace {
32 33
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 AddressEntryList list; 184 AddressEntryList list;
184 for (size_t i = 0; i < profiles.size(); ++i) 185 for (size_t i = 0; i < profiles.size(); ++i)
185 list.push_back(ProfileToAddressEntry(*profiles[i], labels[i])); 186 list.push_back(ProfileToAddressEntry(*profiles[i], labels[i]));
186 187
187 return list; 188 return list;
188 } 189 }
189 190
190 CountryEntryList GenerateCountryList( 191 CountryEntryList GenerateCountryList(
191 const autofill::PersonalDataManager& personal_data) { 192 const autofill::PersonalDataManager& personal_data) {
192 autofill::CountryComboboxModel model; 193 autofill::CountryComboboxModel model;
193 model.SetCountries(personal_data, base::Callback<bool(const std::string&)>()); 194 model.SetCountries(personal_data, base::Callback<bool(const std::string&)>(),
195 g_browser_process->GetApplicationLocale());
194 const std::vector<std::unique_ptr<autofill::AutofillCountry>>& countries = 196 const std::vector<std::unique_ptr<autofill::AutofillCountry>>& countries =
195 model.countries(); 197 model.countries();
196 198
197 CountryEntryList list; 199 CountryEntryList list;
198 200
199 for (const auto& country : countries) 201 for (const auto& country : countries)
200 list.push_back(CountryToCountryEntry(country.get())); 202 list.push_back(CountryToCountryEntry(country.get()));
201 203
202 return list; 204 return list;
203 } 205 }
204 206
205 CreditCardEntryList GenerateCreditCardList( 207 CreditCardEntryList GenerateCreditCardList(
206 const autofill::PersonalDataManager& personal_data) { 208 const autofill::PersonalDataManager& personal_data) {
207 const std::vector<autofill::CreditCard*>& cards = 209 const std::vector<autofill::CreditCard*>& cards =
208 personal_data.GetCreditCards(); 210 personal_data.GetCreditCards();
209 211
210 CreditCardEntryList list; 212 CreditCardEntryList list;
211 for (const autofill::CreditCard* card : cards) 213 for (const autofill::CreditCard* card : cards)
212 list.push_back(CreditCardToCreditCardEntry(*card)); 214 list.push_back(CreditCardToCreditCardEntry(*card));
213 215
214 return list; 216 return list;
215 } 217 }
216 218
217 } // namespace autofill_util 219 } // namespace autofill_util
218 220
219 } // namespace extensions 221 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698