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 CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "ui/base/models/combobox_model.h" | 14 #include "ui/base/models/combobox_model.h" |
15 | 15 |
16 namespace autofill { | 16 namespace autofill { |
17 | 17 |
18 class AutofillCountry; | 18 class AutofillCountry; |
19 class PersonalDataManager; | 19 class PersonalDataManager; |
20 | 20 |
21 // A model for countries to be used to enter addresses. | 21 // A model for countries to be used to enter addresses. |
22 class CountryComboboxModel : public ui::ComboboxModel { | 22 class CountryComboboxModel : public ui::ComboboxModel { |
23 public: | 23 public: |
24 explicit CountryComboboxModel(const PersonalDataManager& manager); | 24 // When |show_partially_supported_countries| is false, countries with |
| 25 // semi-supported address components (e.g. dependent locality) will be hidden. |
| 26 CountryComboboxModel(const PersonalDataManager& manager, |
| 27 bool show_partially_supported_countries); |
25 virtual ~CountryComboboxModel(); | 28 virtual ~CountryComboboxModel(); |
26 | 29 |
27 // ui::ComboboxModel implementation: | 30 // ui::ComboboxModel implementation: |
28 virtual int GetItemCount() const OVERRIDE; | 31 virtual int GetItemCount() const OVERRIDE; |
29 virtual base::string16 GetItemAt(int index) OVERRIDE; | 32 virtual base::string16 GetItemAt(int index) OVERRIDE; |
30 virtual bool IsItemSeparatorAt(int index) OVERRIDE; | 33 virtual bool IsItemSeparatorAt(int index) OVERRIDE; |
31 | 34 |
32 const std::vector<AutofillCountry*>& countries() const { | 35 const std::vector<AutofillCountry*>& countries() const { |
33 return countries_.get(); | 36 return countries_.get(); |
34 } | 37 } |
35 | 38 |
36 // Returns the default country code for this model. | 39 // Returns the default country code for this model. |
37 std::string GetDefaultCountryCode() const; | 40 std::string GetDefaultCountryCode() const; |
38 | 41 |
39 private: | 42 private: |
40 // The countries to show in the model, including NULL for entries that are | 43 // The countries to show in the model, including NULL for entries that are |
41 // not countries (the separator entry). | 44 // not countries (the separator entry). |
42 ScopedVector<AutofillCountry> countries_; | 45 ScopedVector<AutofillCountry> countries_; |
43 | 46 |
44 DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel); | 47 DISALLOW_COPY_AND_ASSIGN(CountryComboboxModel); |
45 }; | 48 }; |
46 | 49 |
47 } // namespace autofill | 50 } // namespace autofill |
48 | 51 |
49 #endif // CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_ | 52 #endif // CHROME_BROWSER_UI_AUTOFILL_COUNTRY_COMBOBOX_MODEL_H_ |
OLD | NEW |