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 #ifndef ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 5 #ifndef ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
6 #define ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 6 #define ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 class KeyboardBrightnessControlDelegate; | 29 class KeyboardBrightnessControlDelegate; |
30 class ScreenshotDelegate; | 30 class ScreenshotDelegate; |
31 class VolumeControlDelegate; | 31 class VolumeControlDelegate; |
32 | 32 |
33 // AcceleratorController provides functions for registering or unregistering | 33 // AcceleratorController provides functions for registering or unregistering |
34 // global keyboard accelerators, which are handled earlier than any windows. It | 34 // global keyboard accelerators, which are handled earlier than any windows. It |
35 // also implements several handlers as an accelerator target. | 35 // also implements several handlers as an accelerator target. |
36 class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget { | 36 class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget { |
37 public: | 37 public: |
38 AcceleratorController(); | 38 AcceleratorController(); |
39 virtual ~AcceleratorController(); | 39 ~AcceleratorController() override; |
40 | 40 |
41 // A list of possible ways in which an accelerator should be restricted before | 41 // A list of possible ways in which an accelerator should be restricted before |
42 // processing. Any target registered with this controller should respect | 42 // processing. Any target registered with this controller should respect |
43 // restrictions by calling |GetCurrentAcceleratorRestriction| during | 43 // restrictions by calling |GetCurrentAcceleratorRestriction| during |
44 // processing. | 44 // processing. |
45 enum AcceleratorProcessingRestriction { | 45 enum AcceleratorProcessingRestriction { |
46 // Process the accelerator normally. | 46 // Process the accelerator normally. |
47 RESTRICTION_NONE, | 47 RESTRICTION_NONE, |
48 | 48 |
49 // Don't process the accelerator. | 49 // Don't process the accelerator. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Performs the specified action. The |accelerator| may provide additional | 89 // Performs the specified action. The |accelerator| may provide additional |
90 // data the action needs. Returns whether an action was performed | 90 // data the action needs. Returns whether an action was performed |
91 // successfully. | 91 // successfully. |
92 bool PerformAction(int action, | 92 bool PerformAction(int action, |
93 const ui::Accelerator& accelerator); | 93 const ui::Accelerator& accelerator); |
94 | 94 |
95 // Returns the restriction for the current context. | 95 // Returns the restriction for the current context. |
96 AcceleratorProcessingRestriction GetCurrentAcceleratorRestriction(); | 96 AcceleratorProcessingRestriction GetCurrentAcceleratorRestriction(); |
97 | 97 |
98 // Overridden from ui::AcceleratorTarget: | 98 // Overridden from ui::AcceleratorTarget: |
99 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 99 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
100 virtual bool CanHandleAccelerators() const override; | 100 bool CanHandleAccelerators() const override; |
101 | 101 |
102 void SetBrightnessControlDelegate( | 102 void SetBrightnessControlDelegate( |
103 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate); | 103 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate); |
104 void SetImeControlDelegate( | 104 void SetImeControlDelegate( |
105 scoped_ptr<ImeControlDelegate> ime_control_delegate); | 105 scoped_ptr<ImeControlDelegate> ime_control_delegate); |
106 void SetScreenshotDelegate( | 106 void SetScreenshotDelegate( |
107 scoped_ptr<ScreenshotDelegate> screenshot_delegate); | 107 scoped_ptr<ScreenshotDelegate> screenshot_delegate); |
108 BrightnessControlDelegate* brightness_control_delegate() const { | 108 BrightnessControlDelegate* brightness_control_delegate() const { |
109 return brightness_control_delegate_.get(); | 109 return brightness_control_delegate_.get(); |
110 } | 110 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 std::set<int> actions_allowed_in_app_mode_; | 180 std::set<int> actions_allowed_in_app_mode_; |
181 // Actions disallowed if there are no windows. | 181 // Actions disallowed if there are no windows. |
182 std::set<int> actions_needing_window_; | 182 std::set<int> actions_needing_window_; |
183 | 183 |
184 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 184 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
185 }; | 185 }; |
186 | 186 |
187 } // namespace ash | 187 } // namespace ash |
188 | 188 |
189 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 189 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
OLD | NEW |