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 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // is called, and if that handler processes the event (i.e. returns true), | 49 // is called, and if that handler processes the event (i.e. returns true), |
50 // this method immediately returns. If not, we do the same thing on the next | 50 // this method immediately returns. If not, we do the same thing on the next |
51 // target, and so on. | 51 // target, and so on. |
52 // Returns true if an accelerator was activated. | 52 // Returns true if an accelerator was activated. |
53 bool Process(const ui::Accelerator& accelerator); | 53 bool Process(const ui::Accelerator& accelerator); |
54 | 54 |
55 // Overridden from ui::AcceleratorTarget: | 55 // Overridden from ui::AcceleratorTarget: |
56 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 56 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
57 virtual bool CanHandleAccelerators() const OVERRIDE; | 57 virtual bool CanHandleAccelerators() const OVERRIDE; |
58 | 58 |
59 void SetScreenshotDelegate(ScreenshotDelegate* screenshot_delegate); | 59 void SetScreenshotDelegate( |
| 60 scoped_ptr<ScreenshotDelegate> screenshot_delegate); |
60 void SetCapsLockDelegate(scoped_ptr<CapsLockDelegate> caps_lock_delegate); | 61 void SetCapsLockDelegate(scoped_ptr<CapsLockDelegate> caps_lock_delegate); |
61 | 62 |
62 private: | 63 private: |
63 // Initialize the accelerators this class handles as a target. | 64 // Initialize the accelerators this class handles as a target. |
64 void Init(); | 65 void Init(); |
65 | 66 |
66 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 67 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
67 | 68 |
68 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; | 69 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; |
69 scoped_ptr<CapsLockDelegate> caps_lock_delegate_; | 70 scoped_ptr<CapsLockDelegate> caps_lock_delegate_; |
70 | 71 |
71 // A map from accelerators to the AcceleratorAction values, which are used in | 72 // A map from accelerators to the AcceleratorAction values, which are used in |
72 // the implementation. | 73 // the implementation. |
73 std::map<ui::Accelerator, int> accelerators_; | 74 std::map<ui::Accelerator, int> accelerators_; |
74 | 75 |
75 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 76 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
76 }; | 77 }; |
77 | 78 |
78 } // namespace ash | 79 } // namespace ash |
79 | 80 |
80 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 81 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
OLD | NEW |