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/country_combobox_model.h" | 5 #include "chrome/browser/ui/autofill/country_combobox_model.h" |
6 | 6 |
| 7 #include "chrome/browser/browser_process.h" |
7 #include "components/autofill/browser/autofill_country.h" | 8 #include "components/autofill/browser/autofill_country.h" |
8 #include "ui/base/l10n/l10n_util_collator.h" | 9 #include "ui/base/l10n/l10n_util_collator.h" |
9 | 10 |
10 namespace autofill { | 11 namespace autofill { |
11 | 12 |
12 CountryComboboxModel::CountryComboboxModel() { | 13 CountryComboboxModel::CountryComboboxModel() { |
13 // Insert the default country at the top as well as in the ordered list. | 14 // Insert the default country at the top as well as in the ordered list. |
14 std::string app_locale = AutofillCountry::ApplicationLocale(); | 15 std::string app_locale = g_browser_process->GetApplicationLocale(); |
15 std::string default_country_code = | 16 std::string default_country_code = |
16 AutofillCountry::CountryCodeForLocale(app_locale); | 17 AutofillCountry::CountryCodeForLocale(app_locale); |
17 countries_.push_back(new AutofillCountry(default_country_code, app_locale)); | 18 countries_.push_back(new AutofillCountry(default_country_code, app_locale)); |
18 // The separator item. | 19 // The separator item. |
19 countries_.push_back(NULL); | 20 countries_.push_back(NULL); |
20 | 21 |
21 // The sorted list of countries. | 22 // The sorted list of countries. |
22 std::vector<std::string> country_codes; | 23 std::vector<std::string> country_codes; |
23 AutofillCountry::GetAvailableCountries(&country_codes); | 24 AutofillCountry::GetAvailableCountries(&country_codes); |
24 std::vector<AutofillCountry*> sorted_countries; | 25 std::vector<AutofillCountry*> sorted_countries; |
(...skipping 25 matching lines...) Expand all Loading... |
50 // The separator item. Implemented for platforms that don't yet support | 51 // The separator item. Implemented for platforms that don't yet support |
51 // IsItemSeparatorAt(). | 52 // IsItemSeparatorAt(). |
52 return ASCIIToUTF16("---"); | 53 return ASCIIToUTF16("---"); |
53 } | 54 } |
54 | 55 |
55 bool CountryComboboxModel::IsItemSeparatorAt(int index) { | 56 bool CountryComboboxModel::IsItemSeparatorAt(int index) { |
56 return !countries_[index]; | 57 return !countries_[index]; |
57 } | 58 } |
58 | 59 |
59 } // namespace autofill | 60 } // namespace autofill |
OLD | NEW |