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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
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 class BrightnessControlDelegate; | 23 class BrightnessControlDelegate; |
24 class CapsLockDelegate; | 24 class CapsLockDelegate; |
| 25 class ImeControlDelegate; |
25 class ScreenshotDelegate; | 26 class ScreenshotDelegate; |
26 class VolumeControlDelegate; | 27 class VolumeControlDelegate; |
27 | 28 |
28 // AcceleratorController provides functions for registering or unregistering | 29 // AcceleratorController provides functions for registering or unregistering |
29 // global keyboard accelerators, which are handled earlier than any windows. It | 30 // global keyboard accelerators, which are handled earlier than any windows. It |
30 // also implements several handlers as an accelerator target. | 31 // also implements several handlers as an accelerator target. |
31 class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget { | 32 class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget { |
32 public: | 33 public: |
33 AcceleratorController(); | 34 AcceleratorController(); |
34 virtual ~AcceleratorController(); | 35 virtual ~AcceleratorController(); |
(...skipping 19 matching lines...) Expand all Loading... |
54 // Returns true if an accelerator was activated. | 55 // Returns true if an accelerator was activated. |
55 bool Process(const ui::Accelerator& accelerator); | 56 bool Process(const ui::Accelerator& accelerator); |
56 | 57 |
57 // Overridden from ui::AcceleratorTarget: | 58 // Overridden from ui::AcceleratorTarget: |
58 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 59 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
59 virtual bool CanHandleAccelerators() const OVERRIDE; | 60 virtual bool CanHandleAccelerators() const OVERRIDE; |
60 | 61 |
61 void SetBrightnessControlDelegate( | 62 void SetBrightnessControlDelegate( |
62 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate); | 63 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate); |
63 void SetCapsLockDelegate(scoped_ptr<CapsLockDelegate> caps_lock_delegate); | 64 void SetCapsLockDelegate(scoped_ptr<CapsLockDelegate> caps_lock_delegate); |
| 65 void SetImeControlDelegate( |
| 66 scoped_ptr<ImeControlDelegate> ime_control_delegate); |
64 void SetScreenshotDelegate( | 67 void SetScreenshotDelegate( |
65 scoped_ptr<ScreenshotDelegate> screenshot_delegate); | 68 scoped_ptr<ScreenshotDelegate> screenshot_delegate); |
66 void SetVolumeControlDelegate( | 69 void SetVolumeControlDelegate( |
67 scoped_ptr<VolumeControlDelegate> volume_control_delegate); | 70 scoped_ptr<VolumeControlDelegate> volume_control_delegate); |
68 | 71 |
69 private: | 72 private: |
70 // Initialize the accelerators this class handles as a target. | 73 // Initialize the accelerators this class handles as a target. |
71 void Init(); | 74 void Init(); |
72 | 75 |
73 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 76 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
74 | 77 |
75 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; | 78 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; |
76 scoped_ptr<CapsLockDelegate> caps_lock_delegate_; | 79 scoped_ptr<CapsLockDelegate> caps_lock_delegate_; |
| 80 scoped_ptr<ImeControlDelegate> ime_control_delegate_; |
77 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; | 81 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; |
78 scoped_ptr<VolumeControlDelegate> volume_control_delegate_; | 82 scoped_ptr<VolumeControlDelegate> volume_control_delegate_; |
79 | 83 |
80 // A map from accelerators to the AcceleratorAction values, which are used in | 84 // A map from accelerators to the AcceleratorAction values, which are used in |
81 // the implementation. | 85 // the implementation. |
82 std::map<ui::Accelerator, int> accelerators_; | 86 std::map<ui::Accelerator, int> accelerators_; |
83 | 87 |
84 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 88 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
85 }; | 89 }; |
86 | 90 |
87 } // namespace ash | 91 } // namespace ash |
88 | 92 |
89 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 93 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
OLD | NEW |