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

Unified Diff: ui/base/models/simple_menu_model.h

Issue 2138353002: SimpleMenuModel and ButtonMenuItemModel implement AcceleratorProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@menumodel-accelerator-default
Patch Set: Fix compile on Windows. 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/models/simple_menu_model.h
diff --git a/ui/base/models/simple_menu_model.h b/ui/base/models/simple_menu_model.h
index 6c8157577f33d8cf5cf90d17b804017dcca1d17f..8bd0b606c9a6f174dd7a5ef98e800883552a88a9 100644
--- a/ui/base/models/simple_menu_model.h
+++ b/ui/base/models/simple_menu_model.h
@@ -7,9 +7,11 @@
#include <vector>
+#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
+#include "ui/base/accelerators/accelerator.h"
#include "ui/base/models/menu_model.h"
namespace gfx {
@@ -26,21 +28,16 @@ class ButtonMenuItemModel;
// The breadth of MenuModel is not exposed through this API.
class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
public:
- class UI_BASE_EXPORT Delegate {
+ class UI_BASE_EXPORT Delegate
+ : NON_EXPORTED_BASE(public AcceleratorProvider) {
public:
- virtual ~Delegate() {}
+ ~Delegate() override {}
// Methods for determining the state of specific command ids.
virtual bool IsCommandIdChecked(int command_id) const = 0;
virtual bool IsCommandIdEnabled(int command_id) const = 0;
virtual bool IsCommandIdVisible(int command_id) const;
- // Gets the accelerator for the specified command id. Returns true if the
- // command id has a valid accelerator, false otherwise. By default, returns
- // false for all commands.
- virtual bool GetAcceleratorForCommandId(int command_id,
- ui::Accelerator* accelerator) const;
-
// Some command ids have labels, sublabels, minor text and icons that change
// over time.
virtual bool IsItemForCommandIdDynamic(int command_id) const;
@@ -66,6 +63,12 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
// Notifies the delegate that the menu has closed.
virtual void MenuClosed(SimpleMenuModel* source);
+
+ // AcceleratorProvider overrides:
+ // By default, returns false for all commands. Can be further overridden.
+ bool GetAcceleratorForCommandId(
+ int command_id,
+ ui::Accelerator* accelerator) const override;
};
// The Delegate can be NULL, though if it is items can't be checked or
« 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