| 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 "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "ash/ash_export.h" | 14 #include "ash/ash_export.h" |
| 15 #include "ui/base/accelerators/accelerator.h" | 15 #include "ui/base/accelerators/accelerator.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 class AcceleratorManager; | 18 class AcceleratorManager; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace ash { | 21 namespace ash { |
| 22 | 22 |
| 23 struct AcceleratorData; |
| 23 class BrightnessControlDelegate; | 24 class BrightnessControlDelegate; |
| 24 class CapsLockDelegate; | 25 class CapsLockDelegate; |
| 25 class ImeControlDelegate; | 26 class ImeControlDelegate; |
| 26 class KeyboardBrightnessControlDelegate; | 27 class KeyboardBrightnessControlDelegate; |
| 27 class ScreenshotDelegate; | 28 class ScreenshotDelegate; |
| 28 class VolumeControlDelegate; | 29 class VolumeControlDelegate; |
| 29 | 30 |
| 30 // AcceleratorController provides functions for registering or unregistering | 31 // AcceleratorController provides functions for registering or unregistering |
| 31 // global keyboard accelerators, which are handled earlier than any windows. It | 32 // global keyboard accelerators, which are handled earlier than any windows. It |
| 32 // also implements several handlers as an accelerator target. | 33 // also implements several handlers as an accelerator target. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 95 } |
| 95 | 96 |
| 96 private: | 97 private: |
| 97 // Initializes the accelerators this class handles as a target. | 98 // Initializes the accelerators this class handles as a target. |
| 98 void Init(); | 99 void Init(); |
| 99 | 100 |
| 100 // Switches to a 0-indexed (in order of creation) window. | 101 // Switches to a 0-indexed (in order of creation) window. |
| 101 // A negative index switches to the last window in the list. | 102 // A negative index switches to the last window in the list. |
| 102 void SwitchToWindow(int window); | 103 void SwitchToWindow(int window); |
| 103 | 104 |
| 105 // Registers the specified accelerators. |
| 106 void RegisterAccelerators(const AcceleratorData accelerators[], |
| 107 size_t accelerators_length); |
| 108 |
| 104 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 109 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
| 105 | 110 |
| 106 // TODO(derat): BrightnessControlDelegate is also used by the system tray; | 111 // TODO(derat): BrightnessControlDelegate is also used by the system tray; |
| 107 // move it outside of this class. | 112 // move it outside of this class. |
| 108 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; | 113 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; |
| 109 scoped_ptr<CapsLockDelegate> caps_lock_delegate_; | 114 scoped_ptr<CapsLockDelegate> caps_lock_delegate_; |
| 110 scoped_ptr<ImeControlDelegate> ime_control_delegate_; | 115 scoped_ptr<ImeControlDelegate> ime_control_delegate_; |
| 111 scoped_ptr<KeyboardBrightnessControlDelegate> | 116 scoped_ptr<KeyboardBrightnessControlDelegate> |
| 112 keyboard_brightness_control_delegate_; | 117 keyboard_brightness_control_delegate_; |
| 113 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; | 118 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; |
| 114 scoped_ptr<VolumeControlDelegate> volume_control_delegate_; | 119 scoped_ptr<VolumeControlDelegate> volume_control_delegate_; |
| 115 | 120 |
| 116 // A map from accelerators to the AcceleratorAction values, which are used in | 121 // A map from accelerators to the AcceleratorAction values, which are used in |
| 117 // the implementation. | 122 // the implementation. |
| 118 std::map<ui::Accelerator, int> accelerators_; | 123 std::map<ui::Accelerator, int> accelerators_; |
| 119 | 124 |
| 120 // Actions allowed when the user is not signed in. | 125 // Actions allowed when the user is not signed in. |
| 121 std::set<int> actions_allowed_at_login_screen_; | 126 std::set<int> actions_allowed_at_login_screen_; |
| 122 // Actions allowed when the screen is locked. | 127 // Actions allowed when the screen is locked. |
| 123 std::set<int> actions_allowed_at_lock_screen_; | 128 std::set<int> actions_allowed_at_lock_screen_; |
| 124 // Reserved actions. See accelerator_table.h for details. | 129 // Reserved actions. See accelerator_table.h for details. |
| 125 std::set<int> reserved_actions_; | 130 std::set<int> reserved_actions_; |
| 126 | 131 |
| 127 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 132 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
| 128 }; | 133 }; |
| 129 | 134 |
| 130 } // namespace ash | 135 } // namespace ash |
| 131 | 136 |
| 132 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 137 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
| OLD | NEW |