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

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

Issue 2140963002: Added default implementations of GetAcceleratorForCommandId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@acceleratorprovider-const
Patch Set: Rebase. 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/cocoa/menu_controller_unittest.mm ('k') | ui/base/models/button_menu_item_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) 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
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
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_
OLDNEW
« no previous file with comments | « ui/base/cocoa/menu_controller_unittest.mm ('k') | ui/base/models/button_menu_item_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698