OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_AURA_SHELL_SHELL_ACCELERATOR_CONTROLLER_H_ | 5 #ifndef UI_AURA_SHELL_SHELL_ACCELERATOR_CONTROLLER_H_ |
6 #define UI_AURA_SHELL_SHELL_ACCELERATOR_CONTROLLER_H_ | 6 #define UI_AURA_SHELL_SHELL_ACCELERATOR_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include <map> |
| 10 |
9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "ui/aura_shell/aura_shell_export.h" | 14 #include "ui/aura_shell/aura_shell_export.h" |
13 #include "ui/base/accelerators/accelerator.h" | 15 #include "ui/base/accelerators/accelerator.h" |
14 | 16 |
15 namespace ui { | 17 namespace ui { |
16 class AcceleratorManager; | 18 class AcceleratorManager; |
17 } | 19 } |
18 | 20 |
(...skipping 26 matching lines...) Expand all Loading... |
45 // is called, and if that handler processes the event (i.e. returns true), | 47 // is called, and if that handler processes the event (i.e. returns true), |
46 // this method immediately returns. If not, we do the same thing on the next | 48 // this method immediately returns. If not, we do the same thing on the next |
47 // target, and so on. | 49 // target, and so on. |
48 // Returns true if an accelerator was activated. | 50 // Returns true if an accelerator was activated. |
49 bool Process(const ui::Accelerator& accelerator); | 51 bool Process(const ui::Accelerator& accelerator); |
50 | 52 |
51 // Overridden from ui::AcceleratorTarget: | 53 // Overridden from ui::AcceleratorTarget: |
52 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 54 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
53 | 55 |
54 private: | 56 private: |
| 57 // Initialize the accelerators this class handles as a target. |
| 58 void Init(); |
| 59 |
55 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 60 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
56 | 61 |
| 62 // A map from accelerators to the AcceleratorAction values, which are used in |
| 63 // the implementation. |
| 64 std::map<ui::Accelerator, int> accelerators_; |
| 65 |
57 DISALLOW_COPY_AND_ASSIGN(ShellAcceleratorController); | 66 DISALLOW_COPY_AND_ASSIGN(ShellAcceleratorController); |
58 }; | 67 }; |
59 | 68 |
60 } // namespace aura_shell | 69 } // namespace aura_shell |
61 | 70 |
62 #endif // UI_AURA_SHELL_SHELL_ACCELERATOR_CONTROLLER_H_ | 71 #endif // UI_AURA_SHELL_SHELL_ACCELERATOR_CONTROLLER_H_ |
OLD | NEW |