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