| 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 23 matching lines...) Expand all Loading... |
| 34 // or if the current accelerator is repeated or not. | 34 // or if the current accelerator is repeated or not. |
| 35 class ASH_EXPORT AcceleratorControllerContext { | 35 class ASH_EXPORT AcceleratorControllerContext { |
| 36 public: | 36 public: |
| 37 AcceleratorControllerContext(); | 37 AcceleratorControllerContext(); |
| 38 ~AcceleratorControllerContext() {} | 38 ~AcceleratorControllerContext() {} |
| 39 | 39 |
| 40 // Updates context - determines if the accelerator is repeated, as well as | 40 // Updates context - determines if the accelerator is repeated, as well as |
| 41 // event type of the previous accelerator. | 41 // event type of the previous accelerator. |
| 42 void UpdateContext(const ui::Accelerator& accelerator); | 42 void UpdateContext(const ui::Accelerator& accelerator); |
| 43 | 43 |
| 44 const ui::Accelerator& current_accelerator() const { |
| 45 return current_accelerator_; |
| 46 } |
| 44 const ui::Accelerator& previous_accelerator() const { | 47 const ui::Accelerator& previous_accelerator() const { |
| 45 return previous_accelerator_; | 48 return previous_accelerator_; |
| 46 } | 49 } |
| 47 bool repeated() const { | 50 bool repeated() const { |
| 48 return current_accelerator_ == previous_accelerator_ && | 51 return current_accelerator_ == previous_accelerator_ && |
| 49 current_accelerator_.type() != ui::ET_UNKNOWN; | 52 current_accelerator_.type() != ui::ET_UNKNOWN; |
| 50 } | 53 } |
| 51 | 54 |
| 52 private: | 55 private: |
| 53 ui::Accelerator current_accelerator_; | 56 ui::Accelerator current_accelerator_; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 137 |
| 135 void SetKeyboardBrightnessControlDelegate( | 138 void SetKeyboardBrightnessControlDelegate( |
| 136 scoped_ptr<KeyboardBrightnessControlDelegate> | 139 scoped_ptr<KeyboardBrightnessControlDelegate> |
| 137 keyboard_brightness_control_delegate); | 140 keyboard_brightness_control_delegate); |
| 138 | 141 |
| 139 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 142 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
| 140 | 143 |
| 141 // TODO(derat): BrightnessControlDelegate is also used by the system tray; | 144 // TODO(derat): BrightnessControlDelegate is also used by the system tray; |
| 142 // move it outside of this class. | 145 // move it outside of this class. |
| 143 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; | 146 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; |
| 144 ExitWarningHandler exit_warning_handler_; | |
| 145 scoped_ptr<ImeControlDelegate> ime_control_delegate_; | 147 scoped_ptr<ImeControlDelegate> ime_control_delegate_; |
| 146 scoped_ptr<KeyboardBrightnessControlDelegate> | 148 scoped_ptr<KeyboardBrightnessControlDelegate> |
| 147 keyboard_brightness_control_delegate_; | 149 keyboard_brightness_control_delegate_; |
| 148 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; | 150 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; |
| 149 | 151 |
| 150 // Contextual information, eg. if the current accelerator is repeated. | 152 // Contextual information, eg. if the current accelerator is repeated. |
| 151 AcceleratorControllerContext context_; | 153 AcceleratorControllerContext context_; |
| 152 | 154 |
| 155 // Handles the exit accelerator which requires a long hold to exit and |
| 156 // shows a popup with an explanation. |
| 157 ExitWarningHandler exit_warning_handler_; |
| 158 |
| 153 // A map from accelerators to the AcceleratorAction values, which are used in | 159 // A map from accelerators to the AcceleratorAction values, which are used in |
| 154 // the implementation. | 160 // the implementation. |
| 155 std::map<ui::Accelerator, int> accelerators_; | 161 std::map<ui::Accelerator, int> accelerators_; |
| 156 | 162 |
| 157 // Actions allowed when the user is not signed in. | 163 // Actions allowed when the user is not signed in. |
| 158 std::set<int> actions_allowed_at_login_screen_; | 164 std::set<int> actions_allowed_at_login_screen_; |
| 159 // Actions allowed when the screen is locked. | 165 // Actions allowed when the screen is locked. |
| 160 std::set<int> actions_allowed_at_lock_screen_; | 166 std::set<int> actions_allowed_at_lock_screen_; |
| 161 // Actions allowed when a modal window is up. | 167 // Actions allowed when a modal window is up. |
| 162 std::set<int> actions_allowed_at_modal_window_; | 168 std::set<int> actions_allowed_at_modal_window_; |
| 163 // Reserved actions. See accelerator_table.h for details. | 169 // Reserved actions. See accelerator_table.h for details. |
| 164 std::set<int> reserved_actions_; | 170 std::set<int> reserved_actions_; |
| 165 // Actions which will not be repeated while holding the accelerator key. | 171 // Actions which will not be repeated while holding the accelerator key. |
| 166 std::set<int> nonrepeatable_actions_; | 172 std::set<int> nonrepeatable_actions_; |
| 167 // Actions allowed in app mode. | 173 // Actions allowed in app mode. |
| 168 std::set<int> actions_allowed_in_app_mode_; | 174 std::set<int> actions_allowed_in_app_mode_; |
| 169 | 175 |
| 170 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 176 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
| 171 }; | 177 }; |
| 172 | 178 |
| 173 } // namespace ash | 179 } // namespace ash |
| 174 | 180 |
| 175 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 181 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
| OLD | NEW |