| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_ | 5 #ifndef APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_ |
| 6 #define APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_ | 6 #define APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 class Delegate { | 25 class Delegate { |
| 26 public: | 26 public: |
| 27 // Some command ids have labels that change over time. | 27 // Some command ids have labels that change over time. |
| 28 virtual bool IsLabelForCommandIdDynamic(int command_id) const; | 28 virtual bool IsLabelForCommandIdDynamic(int command_id) const; |
| 29 virtual string16 GetLabelForCommandId(int command_id) const; | 29 virtual string16 GetLabelForCommandId(int command_id) const; |
| 30 | 30 |
| 31 // Performs the action associated with the specified command id. | 31 // Performs the action associated with the specified command id. |
| 32 virtual void ExecuteCommand(int command_id) = 0; | 32 virtual void ExecuteCommand(int command_id) = 0; |
| 33 |
| 34 protected: |
| 35 virtual ~Delegate() {} |
| 33 }; | 36 }; |
| 34 | 37 |
| 35 ButtonMenuItemModel(int string_id, ButtonMenuItemModel::Delegate* delegate); | 38 ButtonMenuItemModel(int string_id, ButtonMenuItemModel::Delegate* delegate); |
| 36 ~ButtonMenuItemModel(); | 39 ~ButtonMenuItemModel(); |
| 37 | 40 |
| 38 // Adds a button that will emit |command_id|. All buttons created through | 41 // Adds a button that will emit |command_id|. All buttons created through |
| 39 // this method will have the same size, based on the largest button. | 42 // this method will have the same size, based on the largest button. |
| 40 void AddGroupItemWithStringId(int command_id, int string_id); | 43 void AddGroupItemWithStringId(int command_id, int string_id); |
| 41 | 44 |
| 42 // Adds a button that has an icon instead of a label. | 45 // Adds a button that has an icon instead of a label. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 std::vector<Item> items_; | 89 std::vector<Item> items_; |
| 87 | 90 |
| 88 Delegate* delegate_; | 91 Delegate* delegate_; |
| 89 | 92 |
| 90 DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel); | 93 DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel); |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 } // namespace menus | 96 } // namespace menus |
| 94 | 97 |
| 95 #endif // APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_ | 98 #endif // APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_ |
| OLD | NEW |