| 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 24 matching lines...) Expand all Loading... |
| 35 // repeat flag in its comparison. | 35 // repeat flag in its comparison. |
| 36 class UI_BASE_EXPORT Accelerator { | 36 class UI_BASE_EXPORT Accelerator { |
| 37 public: | 37 public: |
| 38 enum class KeyState { | 38 enum class KeyState { |
| 39 PRESSED, | 39 PRESSED, |
| 40 RELEASED, | 40 RELEASED, |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 Accelerator(); | 43 Accelerator(); |
| 44 // NOTE: this constructor strips out non key related flags. | 44 // NOTE: this constructor strips out non key related flags. |
| 45 Accelerator(KeyboardCode key_code, int modifiers); | 45 Accelerator(KeyboardCode key_code, |
| 46 int modifiers, |
| 47 KeyState key_state = KeyState::PRESSED); |
| 46 explicit Accelerator(const KeyEvent& key_event); | 48 explicit Accelerator(const KeyEvent& key_event); |
| 47 Accelerator(const Accelerator& accelerator); | 49 Accelerator(const Accelerator& accelerator); |
| 48 ~Accelerator(); | 50 ~Accelerator(); |
| 49 | 51 |
| 50 // Masks out all the non-modifiers KeyEvent |flags| and returns only the | 52 // Masks out all the non-modifiers KeyEvent |flags| and returns only the |
| 51 // available modifier ones. This does not include EF_IS_REPEAT. | 53 // available modifier ones. This does not include EF_IS_REPEAT. |
| 52 static int MaskOutKeyEventFlags(int flags); | 54 static int MaskOutKeyEventFlags(int flags); |
| 53 | 55 |
| 54 Accelerator& operator=(const Accelerator& accelerator); | 56 Accelerator& operator=(const Accelerator& accelerator); |
| 55 | 57 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 virtual bool GetAcceleratorForCommandId(int command_id, | 130 virtual bool GetAcceleratorForCommandId(int command_id, |
| 129 Accelerator* accelerator) const = 0; | 131 Accelerator* accelerator) const = 0; |
| 130 | 132 |
| 131 protected: | 133 protected: |
| 132 virtual ~AcceleratorProvider() {} | 134 virtual ~AcceleratorProvider() {} |
| 133 }; | 135 }; |
| 134 | 136 |
| 135 } // namespace ui | 137 } // namespace ui |
| 136 | 138 |
| 137 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ | 139 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ |
| OLD | NEW |