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

Unified Diff: ui/base/accelerators/accelerator_manager.h

Issue 2177983002: Adds AcceleratorManagerDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup 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/BUILD.gn ('k') | ui/base/accelerators/accelerator_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/accelerators/accelerator_manager.h
diff --git a/ui/base/accelerators/accelerator_manager.h b/ui/base/accelerators/accelerator_manager.h
index d103e6fb1706b17c1259550345951f3107a009e4..9db9629fd8ecc8a9aabf7fa974fe15f1af2cdd75 100644
--- a/ui/base/accelerators/accelerator_manager.h
+++ b/ui/base/accelerators/accelerator_manager.h
@@ -16,7 +16,10 @@
namespace ui {
-// The AcceleratorManger is used to handle keyboard accelerators.
+class AcceleratorManagerDelegate;
+
+// AcceleratorManger handles processing of accelerators. A delegate may be
+// supplied which is notified as unique accelerators are added and removed.
class UI_BASE_EXPORT AcceleratorManager {
public:
enum HandlerPriority {
@@ -24,7 +27,7 @@ class UI_BASE_EXPORT AcceleratorManager {
kHighPriority,
};
- AcceleratorManager();
+ explicit AcceleratorManager(AcceleratorManagerDelegate* = nullptr);
~AcceleratorManager();
// Register a keyboard accelerator for the specified target. If multiple
@@ -70,11 +73,18 @@ class UI_BASE_EXPORT AcceleratorManager {
private:
// The accelerators and associated targets.
- typedef std::list<AcceleratorTarget*> AcceleratorTargetList;
+ using AcceleratorTargetList = std::list<AcceleratorTarget*>;
// This construct pairs together a |bool| (denoting whether the list contains
// a priority_handler at the front) with the list of AcceleratorTargets.
- typedef std::pair<bool, AcceleratorTargetList> AcceleratorTargets;
- typedef std::map<Accelerator, AcceleratorTargets> AcceleratorMap;
+ using AcceleratorTargets = std::pair<bool, AcceleratorTargetList>;
+ using AcceleratorMap = std::map<Accelerator, AcceleratorTargets>;
+
+ // Implementation of Unregister(). |map_iter| points to the accelerator to
+ // remove, and |target| the AcceleratorTarget to remove.
+ void UnregisterImpl(AcceleratorMap::iterator map_iter,
+ AcceleratorTarget* target);
+
+ AcceleratorManagerDelegate* delegate_;
AcceleratorMap accelerators_;
DISALLOW_COPY_AND_ASSIGN(AcceleratorManager);
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/accelerators/accelerator_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698