Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: ui/base/models/simple_menu_model.h

Issue 2133013002: AcceleratorProvider: Make GetAcceleratorForCommandId const. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix overrides on Mac and Chrome OS. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/models/button_menu_item_model.h ('k') | ui/base/models/simple_menu_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ 5 #ifndef UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_
6 #define UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ 6 #define UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 21 matching lines...) Expand all
32 32
33 // Methods for determining the state of specific command ids. 33 // Methods for determining the state of specific command ids.
34 virtual bool IsCommandIdChecked(int command_id) const = 0; 34 virtual bool IsCommandIdChecked(int command_id) const = 0;
35 virtual bool IsCommandIdEnabled(int command_id) const = 0; 35 virtual bool IsCommandIdEnabled(int command_id) const = 0;
36 virtual bool IsCommandIdVisible(int command_id) const; 36 virtual bool IsCommandIdVisible(int command_id) const;
37 37
38 // Gets the accelerator for the specified command id. Returns true if the 38 // Gets the accelerator for the specified command id. Returns true if the
39 // command id has a valid accelerator, false otherwise. 39 // command id has a valid accelerator, false otherwise.
40 virtual bool GetAcceleratorForCommandId( 40 virtual bool GetAcceleratorForCommandId(
41 int command_id, 41 int command_id,
42 ui::Accelerator* accelerator) = 0; 42 ui::Accelerator* accelerator) const = 0;
43 43
44 // Some command ids have labels, sublabels, minor text and icons that change 44 // Some command ids have labels, sublabels, minor text and icons that change
45 // over time. 45 // over time.
46 virtual bool IsItemForCommandIdDynamic(int command_id) const; 46 virtual bool IsItemForCommandIdDynamic(int command_id) const;
47 virtual base::string16 GetLabelForCommandId(int command_id) const; 47 virtual base::string16 GetLabelForCommandId(int command_id) const;
48 virtual base::string16 GetSublabelForCommandId(int command_id) const; 48 virtual base::string16 GetSublabelForCommandId(int command_id) const;
49 virtual base::string16 GetMinorTextForCommandId(int command_id) const; 49 virtual base::string16 GetMinorTextForCommandId(int command_id) const;
50 // Gets the icon for the item with the specified id, returning true if there 50 // Gets the icon for the item with the specified id, returning true if there
51 // is an icon, false otherwise. 51 // is an icon, false otherwise.
52 virtual bool GetIconForCommandId(int command_id, 52 virtual bool GetIconForCommandId(int command_id,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 void SetSublabel(int index, const base::string16& sublabel); 127 void SetSublabel(int index, const base::string16& sublabel);
128 128
129 // Sets the minor text for the item at |index|. 129 // Sets the minor text for the item at |index|.
130 void SetMinorText(int index, const base::string16& minor_text); 130 void SetMinorText(int index, const base::string16& minor_text);
131 131
132 // Clears all items. Note that it does not free MenuModel of submenu. 132 // Clears all items. Note that it does not free MenuModel of submenu.
133 void Clear(); 133 void Clear();
134 134
135 // Returns the index of the item that has the given |command_id|. Returns 135 // Returns the index of the item that has the given |command_id|. Returns
136 // -1 if not found. 136 // -1 if not found.
137 int GetIndexOfCommandId(int command_id); 137 int GetIndexOfCommandId(int command_id) const;
138 138
139 // Overridden from MenuModel: 139 // Overridden from MenuModel:
140 bool HasIcons() const override; 140 bool HasIcons() const override;
141 int GetItemCount() const override; 141 int GetItemCount() const override;
142 ItemType GetTypeAt(int index) const override; 142 ItemType GetTypeAt(int index) const override;
143 ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override; 143 ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override;
144 int GetCommandIdAt(int index) const override; 144 int GetCommandIdAt(int index) const override;
145 base::string16 GetLabelAt(int index) const override; 145 base::string16 GetLabelAt(int index) const override;
146 base::string16 GetSublabelAt(int index) const override; 146 base::string16 GetSublabelAt(int index) const override;
147 base::string16 GetMinorTextAt(int index) const override; 147 base::string16 GetMinorTextAt(int index) const override;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 MenuModelDelegate* menu_model_delegate_; 194 MenuModelDelegate* menu_model_delegate_;
195 195
196 base::WeakPtrFactory<SimpleMenuModel> method_factory_; 196 base::WeakPtrFactory<SimpleMenuModel> method_factory_;
197 197
198 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); 198 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel);
199 }; 199 };
200 200
201 } // namespace ui 201 } // namespace ui
202 202
203 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ 203 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « ui/base/models/button_menu_item_model.h ('k') | ui/base/models/simple_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698