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 |
11 #ifndef UI_BASE_ACCELERATORS_ACCELERATOR_H_ | 11 #ifndef UI_BASE_ACCELERATORS_ACCELERATOR_H_ |
12 #define UI_BASE_ACCELERATORS_ACCELERATOR_H_ | 12 #define UI_BASE_ACCELERATORS_ACCELERATOR_H_ |
13 | 13 |
| 14 #include <utility> |
| 15 |
14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
15 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
16 #include "ui/base/accelerators/platform_accelerator.h" | 18 #include "ui/base/accelerators/platform_accelerator.h" |
17 #include "ui/base/ui_base_export.h" | 19 #include "ui/base/ui_base_export.h" |
18 #include "ui/events/event_constants.h" | 20 #include "ui/events/event_constants.h" |
19 #include "ui/events/keycodes/keyboard_codes.h" | 21 #include "ui/events/keycodes/keyboard_codes.h" |
20 | 22 |
21 namespace ui { | 23 namespace ui { |
22 | 24 |
23 class KeyEvent; | 25 class KeyEvent; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 bool IsShiftDown() const; | 61 bool IsShiftDown() const; |
60 bool IsCtrlDown() const; | 62 bool IsCtrlDown() const; |
61 bool IsAltDown() const; | 63 bool IsAltDown() const; |
62 bool IsCmdDown() const; | 64 bool IsCmdDown() const; |
63 bool IsRepeat() const; | 65 bool IsRepeat() const; |
64 | 66 |
65 // Returns a string with the localized shortcut if any. | 67 // Returns a string with the localized shortcut if any. |
66 base::string16 GetShortcutText() const; | 68 base::string16 GetShortcutText() const; |
67 | 69 |
68 void set_platform_accelerator(scoped_ptr<PlatformAccelerator> p) { | 70 void set_platform_accelerator(scoped_ptr<PlatformAccelerator> p) { |
69 platform_accelerator_ = p.Pass(); | 71 platform_accelerator_ = std::move(p); |
70 } | 72 } |
71 | 73 |
72 // This class keeps ownership of the returned object. | 74 // This class keeps ownership of the returned object. |
73 const PlatformAccelerator* platform_accelerator() const { | 75 const PlatformAccelerator* platform_accelerator() const { |
74 return platform_accelerator_.get(); | 76 return platform_accelerator_.get(); |
75 } | 77 } |
76 | 78 |
77 void set_is_repeat(bool is_repeat) { is_repeat_ = is_repeat; } | 79 void set_is_repeat(bool is_repeat) { is_repeat_ = is_repeat; } |
78 | 80 |
79 protected: | 81 protected: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 virtual bool GetAcceleratorForCommandId(int command_id, | 121 virtual bool GetAcceleratorForCommandId(int command_id, |
120 ui::Accelerator* accelerator) = 0; | 122 ui::Accelerator* accelerator) = 0; |
121 | 123 |
122 protected: | 124 protected: |
123 virtual ~AcceleratorProvider() {} | 125 virtual ~AcceleratorProvider() {} |
124 }; | 126 }; |
125 | 127 |
126 } // namespace ui | 128 } // namespace ui |
127 | 129 |
128 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ | 130 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ |
OLD | NEW |