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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_COMBOBOX_MODEL_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_COMBOBOX_MODEL_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_COMBOBOX_MODEL_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_COMBOBOX_MODEL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 20 matching lines...) Expand all Loading... |
31 // |manager| determines the default choice. | 31 // |manager| determines the default choice. |
32 void SetCountries(const PersonalDataManager& manager, | 32 void SetCountries(const PersonalDataManager& manager, |
33 const base::Callback<bool(const std::string&)>& filter, | 33 const base::Callback<bool(const std::string&)>& filter, |
34 const std::string& app_locale); | 34 const std::string& app_locale); |
35 | 35 |
36 // ui::ComboboxModel implementation: | 36 // ui::ComboboxModel implementation: |
37 int GetItemCount() const override; | 37 int GetItemCount() const override; |
38 base::string16 GetItemAt(int index) override; | 38 base::string16 GetItemAt(int index) override; |
39 bool IsItemSeparatorAt(int index) override; | 39 bool IsItemSeparatorAt(int index) override; |
40 | 40 |
| 41 // The list of countries always has the default country at the top as well as |
| 42 // within the sorted vector. |
41 const CountryVector& countries() const { return countries_; } | 43 const CountryVector& countries() const { return countries_; } |
42 | 44 |
43 // Returns the default country code for this model. | 45 // Returns the default country code for this model. |
44 std::string GetDefaultCountryCode() const; | 46 std::string GetDefaultCountryCode() const; |
45 | 47 |
46 private: | 48 private: |
47 // The countries to show in the model, including NULL for entries that are | 49 // The countries to show in the model, including NULL for entries that are |
48 // not countries (the separator entry). | 50 // not countries (the separator entry). |
49 CountryVector countries_; | 51 CountryVector countries_; |
50 | 52 |
51 DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel); | 53 DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel); |
52 }; | 54 }; |
53 | 55 |
54 } // namespace autofill | 56 } // namespace autofill |
55 | 57 |
56 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_COMBOBOX_MODEL_H_ | 58 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_COMBOBOX_MODEL_H_ |
OLD | NEW |