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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 private: | 90 private: |
91 // The keycode (VK_...). | 91 // The keycode (VK_...). |
92 KeyboardCode key_code_; | 92 KeyboardCode key_code_; |
93 | 93 |
94 KeyState key_state_; | 94 KeyState key_state_; |
95 | 95 |
96 // The state of the Shift/Ctrl/Alt keys. This corresponds to Event::flags(). | 96 // The state of the Shift/Ctrl/Alt keys. This corresponds to Event::flags(). |
97 int modifiers_; | 97 int modifiers_; |
98 | 98 |
99 // Stores platform specific data. May be NULL. | 99 // Stores platform specific data. May be NULL. |
| 100 // TODO: this is only used in Mac code and should be removed from here. |
| 101 // http://crbug.com/702823. |
100 std::unique_ptr<PlatformAccelerator> platform_accelerator_; | 102 std::unique_ptr<PlatformAccelerator> platform_accelerator_; |
101 }; | 103 }; |
102 | 104 |
103 // An interface that classes that want to register for keyboard accelerators | 105 // An interface that classes that want to register for keyboard accelerators |
104 // should implement. | 106 // should implement. |
105 class UI_BASE_EXPORT AcceleratorTarget { | 107 class UI_BASE_EXPORT AcceleratorTarget { |
106 public: | 108 public: |
107 // Should return true if the accelerator was processed. | 109 // Should return true if the accelerator was processed. |
108 virtual bool AcceleratorPressed(const Accelerator& accelerator) = 0; | 110 virtual bool AcceleratorPressed(const Accelerator& accelerator) = 0; |
109 | 111 |
(...skipping 16 matching lines...) Expand all Loading... |
126 virtual bool GetAcceleratorForCommandId(int command_id, | 128 virtual bool GetAcceleratorForCommandId(int command_id, |
127 Accelerator* accelerator) const = 0; | 129 Accelerator* accelerator) const = 0; |
128 | 130 |
129 protected: | 131 protected: |
130 virtual ~AcceleratorProvider() {} | 132 virtual ~AcceleratorProvider() {} |
131 }; | 133 }; |
132 | 134 |
133 } // namespace ui | 135 } // namespace ui |
134 | 136 |
135 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ | 137 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ |
OLD | NEW |