| 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[], |
| (...skipping 11 matching lines...) Expand all Loading... |
| 145 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 142 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
| 146 | 143 |
| 147 // TODO(derat): BrightnessControlDelegate is also used by the system tray; | 144 // TODO(derat): BrightnessControlDelegate is also used by the system tray; |
| 148 // move it outside of this class. | 145 // move it outside of this class. |
| 149 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; | 146 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; |
| 150 scoped_ptr<ImeControlDelegate> ime_control_delegate_; | 147 scoped_ptr<ImeControlDelegate> ime_control_delegate_; |
| 151 scoped_ptr<KeyboardBrightnessControlDelegate> | 148 scoped_ptr<KeyboardBrightnessControlDelegate> |
| 152 keyboard_brightness_control_delegate_; | 149 keyboard_brightness_control_delegate_; |
| 153 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; | 150 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; |
| 154 | 151 |
| 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 | 152 // Handles the exit accelerator which requires a double press to exit and |
| 160 // shows a popup with an explanation. | 153 // shows a popup with an explanation. |
| 161 ExitWarningHandler exit_warning_handler_; | 154 ExitWarningHandler exit_warning_handler_; |
| 162 | 155 |
| 163 // A map from accelerators to the AcceleratorAction values, which are used in | 156 // A map from accelerators to the AcceleratorAction values, which are used in |
| 164 // the implementation. | 157 // the implementation. |
| 165 std::map<ui::Accelerator, int> accelerators_; | 158 std::map<ui::Accelerator, int> accelerators_; |
| 166 | 159 |
| 167 // Actions allowed when the user is not signed in. | 160 // Actions allowed when the user is not signed in. |
| 168 std::set<int> actions_allowed_at_login_screen_; | 161 std::set<int> actions_allowed_at_login_screen_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 180 std::set<int> actions_allowed_in_app_mode_; | 173 std::set<int> actions_allowed_in_app_mode_; |
| 181 // Actions disallowed if there are no windows. | 174 // Actions disallowed if there are no windows. |
| 182 std::set<int> actions_needing_window_; | 175 std::set<int> actions_needing_window_; |
| 183 | 176 |
| 184 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 177 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
| 185 }; | 178 }; |
| 186 | 179 |
| 187 } // namespace ash | 180 } // namespace ash |
| 188 | 181 |
| 189 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 182 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
| OLD | NEW |