| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BUTTON_MENU_ITEM_MODEL_H_ | 5 #ifndef UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ |
| 6 #define UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ | 6 #define UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Some command ids have labels that change over time. | 31 // Some command ids have labels that change over time. |
| 32 virtual bool IsItemForCommandIdDynamic(int command_id) const; | 32 virtual bool IsItemForCommandIdDynamic(int command_id) const; |
| 33 virtual base::string16 GetLabelForCommandId(int command_id) const; | 33 virtual base::string16 GetLabelForCommandId(int command_id) const; |
| 34 | 34 |
| 35 // Performs the action associated with the specified command id. | 35 // Performs the action associated with the specified command id. |
| 36 virtual void ExecuteCommand(int command_id, int event_flags) = 0; | 36 virtual void ExecuteCommand(int command_id, int event_flags) = 0; |
| 37 virtual bool IsCommandIdEnabled(int command_id) const; | 37 virtual bool IsCommandIdEnabled(int command_id) const; |
| 38 virtual bool DoesCommandIdDismissMenu(int command_id) const; | 38 virtual bool DoesCommandIdDismissMenu(int command_id) const; |
| 39 | 39 |
| 40 // Gets the accelerator for the specified command id. Returns true if the | 40 // Gets the accelerator for the specified command id. Returns true if the |
| 41 // command id has a valid accelerator, false otherwise. | 41 // command id has a valid accelerator, false otherwise. By default, returns |
| 42 virtual bool GetAcceleratorForCommandId( | 42 // false for all commands. |
| 43 int command_id, | 43 virtual bool GetAcceleratorForCommandId(int command_id, |
| 44 ui::Accelerator* accelerator) const = 0; | 44 ui::Accelerator* accelerator) const; |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 virtual ~Delegate() {} | 47 virtual ~Delegate() {} |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 ButtonMenuItemModel(int string_id, ButtonMenuItemModel::Delegate* delegate); | 50 ButtonMenuItemModel(int string_id, ButtonMenuItemModel::Delegate* delegate); |
| 51 ~ButtonMenuItemModel(); | 51 ~ButtonMenuItemModel(); |
| 52 | 52 |
| 53 // Adds a button that will emit |command_id|. All buttons created through | 53 // Adds a button that will emit |command_id|. All buttons created through |
| 54 // this method will have the same size, based on the largest button. | 54 // this method will have the same size, based on the largest button. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 std::vector<Item> items_; | 117 std::vector<Item> items_; |
| 118 | 118 |
| 119 Delegate* delegate_; | 119 Delegate* delegate_; |
| 120 | 120 |
| 121 DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel); | 121 DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 } // namespace ui | 124 } // namespace ui |
| 125 | 125 |
| 126 #endif // UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ | 126 #endif // UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ |
| OLD | NEW |