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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 countries_.clear(); | 32 countries_.clear(); |
33 | 33 |
34 // Insert the default country at the top as well as in the ordered list. | 34 // Insert the default country at the top as well as in the ordered list. |
35 std::string default_country_code = | 35 std::string default_country_code = |
36 manager.GetDefaultCountryCodeForNewAddress(); | 36 manager.GetDefaultCountryCodeForNewAddress(); |
37 DCHECK(!default_country_code.empty()); | 37 DCHECK(!default_country_code.empty()); |
38 | 38 |
39 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 39 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
40 if (filter.is_null() || filter.Run(default_country_code)) { | 40 if (filter.is_null() || filter.Run(default_country_code)) { |
41 countries_.push_back(new AutofillCountry(default_country_code, app_locale)); | 41 countries_.push_back(new AutofillCountry(default_country_code, app_locale)); |
42 #if !defined(OS_ANDROID) | |
aurimas (slooooooooow)
2014/08/01 15:18:21
We don't cant separators in Android UI?
Evan Stade
2014/08/01 18:59:23
there are already separators between every item in
aurimas (slooooooooow)
2014/08/04 15:37:03
Can you add a comment explaining that?
Evan Stade
2014/08/04 20:36:04
Done.
| |
42 // The separator item. | 43 // The separator item. |
43 countries_.push_back(NULL); | 44 countries_.push_back(NULL); |
45 #endif | |
44 } | 46 } |
45 | 47 |
46 // The sorted list of countries. | 48 // The sorted list of countries. |
47 std::vector<std::string> available_countries; | 49 std::vector<std::string> available_countries; |
48 AutofillCountry::GetAvailableCountries(&available_countries); | 50 AutofillCountry::GetAvailableCountries(&available_countries); |
49 | 51 |
50 #if defined(ENABLE_AUTOFILL_DIALOG) | 52 #if defined(ENABLE_AUTOFILL_DIALOG) |
51 // Filter out the countries that do not have rules for address input and | 53 // Filter out the countries that do not have rules for address input and |
52 // validation. | 54 // validation. |
53 const std::vector<std::string>& addressinput_countries = | 55 const std::vector<std::string>& addressinput_countries = |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 | 95 |
94 bool CountryComboboxModel::IsItemSeparatorAt(int index) { | 96 bool CountryComboboxModel::IsItemSeparatorAt(int index) { |
95 return !countries_[index]; | 97 return !countries_[index]; |
96 } | 98 } |
97 | 99 |
98 std::string CountryComboboxModel::GetDefaultCountryCode() const { | 100 std::string CountryComboboxModel::GetDefaultCountryCode() const { |
99 return countries_[GetDefaultIndex()]->country_code(); | 101 return countries_[GetDefaultIndex()]->country_code(); |
100 } | 102 } |
101 | 103 |
102 } // namespace autofill | 104 } // namespace autofill |
OLD | NEW |