OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This class describe a keyboard accelerator (or keyboard shortcut). | 5 // This class describe a keyboard accelerator (or keyboard shortcut). |
6 // Keyboard accelerators are registered with the FocusManager. | 6 // Keyboard accelerators are registered with the FocusManager. |
7 // It has a copy constructor and assignment operator so that it can be copied. | 7 // It has a copy constructor and assignment operator so that it can be copied. |
8 // It also defines the < operator so that it can be used as a key in a std::map. | 8 // It also defines the < operator so that it can be used as a key in a std::map. |
9 // | 9 // |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 public: | 110 public: |
111 // Gets the accelerator for the specified command id. Returns true if the | 111 // Gets the accelerator for the specified command id. Returns true if the |
112 // command id has a valid accelerator, false otherwise. | 112 // command id has a valid accelerator, false otherwise. |
113 virtual bool GetAcceleratorForCommandId(int command_id, | 113 virtual bool GetAcceleratorForCommandId(int command_id, |
114 ui::Accelerator* accelerator) = 0; | 114 ui::Accelerator* accelerator) = 0; |
115 | 115 |
116 protected: | 116 protected: |
117 virtual ~AcceleratorProvider() {} | 117 virtual ~AcceleratorProvider() {} |
118 }; | 118 }; |
119 | 119 |
120 // An interface for dispatching accelerators to AcceleratorTargets. | |
121 class UI_BASE_EXPORT AcceleratorProcessor { | |
sky
2015/01/08 23:39:26
Is there a reason this isn't in its own header?
Andre
2015/01/09 00:06:15
Done, moved to its own header.
| |
122 public: | |
123 // Activate the target associated with the specified accelerator. | |
124 // First, AcceleratorPressed handler of the most recently registered target | |
125 // is called, and if that handler processes the event (i.e. returns true), | |
126 // this method immediately returns. If not, we do the same thing on the next | |
127 // target, and so on. | |
128 // Returns true if an accelerator was activated. | |
129 virtual bool ProcessAccelerator(const Accelerator& accelerator) = 0; | |
130 | |
131 // Returns the AcceleratorTarget that should be activated for the specified | |
132 // keyboard accelerator, or NULL if no view is registered for that keyboard | |
sky
2015/01/08 23:39:26
view->target
Andre
2015/01/09 00:06:15
Done.
| |
133 // accelerator. | |
134 virtual AcceleratorTarget* GetTargetForAccelerator( | |
135 const Accelerator& accelerator) const = 0; | |
136 | |
137 protected: | |
138 virtual ~AcceleratorProcessor() {} | |
139 }; | |
140 | |
120 } // namespace ui | 141 } // namespace ui |
121 | 142 |
122 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ | 143 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ |
OLD | NEW |