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 |
11 #include "ash/accelerators/exit_warning_handler.h" | 11 #include "ash/accelerators/exit_warning_handler.h" |
12 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "ui/base/accelerators/accelerator.h" | 17 #include "ui/base/accelerators/accelerator.h" |
18 #include "ui/base/accelerators/accelerator_history.h" | |
18 | 19 |
19 namespace ui { | 20 namespace ui { |
20 class AcceleratorManager; | 21 class AcceleratorManager; |
21 } | 22 } |
22 | 23 |
23 namespace ash { | 24 namespace ash { |
24 | 25 |
25 struct AcceleratorData; | 26 struct AcceleratorData; |
26 class BrightnessControlDelegate; | 27 class BrightnessControlDelegate; |
27 class ExitWarningHandler; | 28 class ExitWarningHandler; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 } | 111 } |
111 ScreenshotDelegate* screenshot_delegate() { | 112 ScreenshotDelegate* screenshot_delegate() { |
112 return screenshot_delegate_.get(); | 113 return screenshot_delegate_.get(); |
113 } | 114 } |
114 | 115 |
115 // Provides access to the ExitWarningHandler for testing. | 116 // Provides access to the ExitWarningHandler for testing. |
116 ExitWarningHandler* GetExitWarningHandlerForTest() { | 117 ExitWarningHandler* GetExitWarningHandlerForTest() { |
117 return &exit_warning_handler_; | 118 return &exit_warning_handler_; |
118 } | 119 } |
119 | 120 |
120 const ui::Accelerator& previous_accelerator_for_test() const { | |
121 return previous_accelerator_; | |
122 } | |
123 | |
124 private: | 121 private: |
125 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, GlobalAccelerators); | 122 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, GlobalAccelerators); |
126 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, | 123 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, |
127 DontRepeatToggleFullscreen); | 124 DontRepeatToggleFullscreen); |
128 | 125 |
129 // Initializes the accelerators this class handles as a target. | 126 // Initializes the accelerators this class handles as a target. |
130 void Init(); | 127 void Init(); |
131 | 128 |
132 // Registers the specified accelerators. | 129 // Registers the specified accelerators. |
133 void RegisterAccelerators(const AcceleratorData accelerators[], | 130 void RegisterAccelerators(const AcceleratorData accelerators[], |
134 size_t accelerators_length); | 131 size_t accelerators_length); |
135 | 132 |
136 // Get the accelerator restriction for the given action. Supply an |action| | 133 // Get the accelerator restriction for the given action. Supply an |action| |
137 // of -1 to get restrictions that apply for the current context. | 134 // of -1 to get restrictions that apply for the current context. |
138 AcceleratorProcessingRestriction GetAcceleratorProcessingRestriction( | 135 AcceleratorProcessingRestriction GetAcceleratorProcessingRestriction( |
139 int action); | 136 int action); |
140 | 137 |
141 void SetKeyboardBrightnessControlDelegate( | 138 void SetKeyboardBrightnessControlDelegate( |
142 scoped_ptr<KeyboardBrightnessControlDelegate> | 139 scoped_ptr<KeyboardBrightnessControlDelegate> |
143 keyboard_brightness_control_delegate); | 140 keyboard_brightness_control_delegate); |
144 | 141 |
142 | |
Jun Mukai
2014/11/15 01:56:33
remove this blank line
afakhry
2014/11/15 02:40:31
Done.
| |
145 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 143 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
146 | 144 |
147 // TODO(derat): BrightnessControlDelegate is also used by the system tray; | 145 // TODO(derat): BrightnessControlDelegate is also used by the system tray; |
148 // move it outside of this class. | 146 // move it outside of this class. |
149 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; | 147 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; |
150 scoped_ptr<ImeControlDelegate> ime_control_delegate_; | 148 scoped_ptr<ImeControlDelegate> ime_control_delegate_; |
151 scoped_ptr<KeyboardBrightnessControlDelegate> | 149 scoped_ptr<KeyboardBrightnessControlDelegate> |
152 keyboard_brightness_control_delegate_; | 150 keyboard_brightness_control_delegate_; |
153 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; | 151 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; |
154 | 152 |
155 // Remember previous accelerator as some accelerator needs to be fired | |
156 // with a specific sequence. | |
157 ui::Accelerator previous_accelerator_; | |
158 | |
159 // Handles the exit accelerator which requires a double press to exit and | 153 // Handles the exit accelerator which requires a double press to exit and |
160 // shows a popup with an explanation. | 154 // shows a popup with an explanation. |
161 ExitWarningHandler exit_warning_handler_; | 155 ExitWarningHandler exit_warning_handler_; |
162 | 156 |
163 // A map from accelerators to the AcceleratorAction values, which are used in | 157 // A map from accelerators to the AcceleratorAction values, which are used in |
164 // the implementation. | 158 // the implementation. |
165 std::map<ui::Accelerator, int> accelerators_; | 159 std::map<ui::Accelerator, int> accelerators_; |
166 | 160 |
167 // Actions allowed when the user is not signed in. | 161 // Actions allowed when the user is not signed in. |
168 std::set<int> actions_allowed_at_login_screen_; | 162 std::set<int> actions_allowed_at_login_screen_; |
(...skipping 11 matching lines...) Expand all Loading... | |
180 std::set<int> actions_allowed_in_app_mode_; | 174 std::set<int> actions_allowed_in_app_mode_; |
181 // Actions disallowed if there are no windows. | 175 // Actions disallowed if there are no windows. |
182 std::set<int> actions_needing_window_; | 176 std::set<int> actions_needing_window_; |
183 | 177 |
184 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 178 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
185 }; | 179 }; |
186 | 180 |
187 } // namespace ash | 181 } // namespace ash |
188 | 182 |
189 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 183 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
OLD | NEW |