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_AUTOFILL_DIALOG_MODELS_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Sets which item is checked. | 73 // Sets which item is checked. |
74 void SetCheckedItem(const std::string& item_key); | 74 void SetCheckedItem(const std::string& item_key); |
75 void SetCheckedIndex(size_t index); | 75 void SetCheckedIndex(size_t index); |
76 | 76 |
77 int checked_item() const { return checked_item_; } | 77 int checked_item() const { return checked_item_; } |
78 | 78 |
79 // Enable/disable an item by key. | 79 // Enable/disable an item by key. |
80 void SetEnabled(const std::string& item_key, bool enabled); | 80 void SetEnabled(const std::string& item_key, bool enabled); |
81 | 81 |
82 // ui::SimpleMenuModel::Delegate implementation. | 82 // ui::SimpleMenuModel::Delegate implementation. |
83 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 83 virtual bool IsCommandIdChecked(int command_id) const override; |
84 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 84 virtual bool IsCommandIdEnabled(int command_id) const override; |
85 virtual bool GetAcceleratorForCommandId( | 85 virtual bool GetAcceleratorForCommandId( |
86 int command_id, | 86 int command_id, |
87 ui::Accelerator* accelerator) OVERRIDE; | 87 ui::Accelerator* accelerator) override; |
88 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 88 virtual void ExecuteCommand(int command_id, int event_flags) override; |
89 | 89 |
90 private: | 90 private: |
91 // Represents an item in this model. | 91 // Represents an item in this model. |
92 struct Item { | 92 struct Item { |
93 std::string key; // The key of the item. | 93 std::string key; // The key of the item. |
94 bool enabled; // Whether the item is selectable. | 94 bool enabled; // Whether the item is selectable. |
95 }; | 95 }; |
96 // The items this model represents in presentation order. | 96 // The items this model represents in presentation order. |
97 // Note: the index in this vector is the |command_id| of the item. | 97 // Note: the index in this vector is the |command_id| of the item. |
98 std::vector<Item> items_; | 98 std::vector<Item> items_; |
(...skipping 12 matching lines...) Expand all Loading... |
111 | 111 |
112 // A model for possible months in the Gregorian calendar. | 112 // A model for possible months in the Gregorian calendar. |
113 class MonthComboboxModel : public ui::ComboboxModel { | 113 class MonthComboboxModel : public ui::ComboboxModel { |
114 public: | 114 public: |
115 MonthComboboxModel(); | 115 MonthComboboxModel(); |
116 virtual ~MonthComboboxModel(); | 116 virtual ~MonthComboboxModel(); |
117 | 117 |
118 static base::string16 FormatMonth(int index); | 118 static base::string16 FormatMonth(int index); |
119 | 119 |
120 // ui::Combobox implementation: | 120 // ui::Combobox implementation: |
121 virtual int GetItemCount() const OVERRIDE; | 121 virtual int GetItemCount() const override; |
122 virtual base::string16 GetItemAt(int index) OVERRIDE; | 122 virtual base::string16 GetItemAt(int index) override; |
123 | 123 |
124 private: | 124 private: |
125 DISALLOW_COPY_AND_ASSIGN(MonthComboboxModel); | 125 DISALLOW_COPY_AND_ASSIGN(MonthComboboxModel); |
126 }; | 126 }; |
127 | 127 |
128 // A model for years between now and a decade hence. | 128 // A model for years between now and a decade hence. |
129 class YearComboboxModel : public ui::ComboboxModel { | 129 class YearComboboxModel : public ui::ComboboxModel { |
130 public: | 130 public: |
131 YearComboboxModel(); | 131 YearComboboxModel(); |
132 virtual ~YearComboboxModel(); | 132 virtual ~YearComboboxModel(); |
133 | 133 |
134 // ui::Combobox implementation: | 134 // ui::Combobox implementation: |
135 virtual int GetItemCount() const OVERRIDE; | 135 virtual int GetItemCount() const override; |
136 virtual base::string16 GetItemAt(int index) OVERRIDE; | 136 virtual base::string16 GetItemAt(int index) override; |
137 | 137 |
138 private: | 138 private: |
139 // The current year (e.g., 2012). | 139 // The current year (e.g., 2012). |
140 int this_year_; | 140 int this_year_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel); | 142 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel); |
143 }; | 143 }; |
144 | 144 |
145 } // namespace autofill | 145 } // namespace autofill |
146 | 146 |
147 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ | 147 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ |
OLD | NEW |