OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_COCOA_ACCELERATORS_COCOA_H_ | 5 #ifndef CHROME_BROWSER_COCOA_ACCELERATORS_COCOA_H_ |
6 #define CHROME_BROWSER_COCOA_ACCELERATORS_COCOA_H_ | 6 #define CHROME_BROWSER_COCOA_ACCELERATORS_COCOA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "app/menus/accelerator_cocoa.h" | 11 #include "app/menus/accelerator_cocoa.h" |
12 | 12 |
13 // This class maintains a map of command_ids to AcceleratorCocoa objects (see | 13 // This class maintains a map of command_ids to AcceleratorCocoa objects (see |
14 // chrome/app/chrome_dll_resource.h). Currently, this only lists the commands | 14 // chrome/app/chrome_command_ids.h). Currently, this only lists the commands |
15 // that are used in the Wrench menu. | 15 // that are used in the Wrench menu. |
16 // | 16 // |
17 // It is recommended that this class be used as a singleton so that the key map | 17 // It is recommended that this class be used as a singleton so that the key map |
18 // isn't created multiple places. | 18 // isn't created multiple places. |
19 // | 19 // |
20 // #import "base/singleton.h" | 20 // #import "base/singleton.h" |
21 // ... | 21 // ... |
22 // AcceleratorsCocoa* keymap = Singleton<AcceleratorsCocoa>::get(); | 22 // AcceleratorsCocoa* keymap = Singleton<AcceleratorsCocoa>::get(); |
23 // return keymap->GetAcceleratorForCommand(IDC_COPY); | 23 // return keymap->GetAcceleratorForCommand(IDC_COPY); |
24 // | 24 // |
25 class AcceleratorsCocoa { | 25 class AcceleratorsCocoa { |
26 public: | 26 public: |
27 AcceleratorsCocoa(); | 27 AcceleratorsCocoa(); |
28 ~AcceleratorsCocoa() {} | 28 ~AcceleratorsCocoa() {} |
29 | 29 |
30 typedef std::map<int, menus::AcceleratorCocoa> AcceleratorCocoaMap; | 30 typedef std::map<int, menus::AcceleratorCocoa> AcceleratorCocoaMap; |
31 | 31 |
32 // Returns NULL if there is no accelerator for the command. | 32 // Returns NULL if there is no accelerator for the command. |
33 const menus::AcceleratorCocoa* GetAcceleratorForCommand(int command_id); | 33 const menus::AcceleratorCocoa* GetAcceleratorForCommand(int command_id); |
34 | 34 |
35 private: | 35 private: |
36 AcceleratorCocoaMap accelerators_; | 36 AcceleratorCocoaMap accelerators_; |
37 | 37 |
38 DISALLOW_COPY_AND_ASSIGN(AcceleratorsCocoa); | 38 DISALLOW_COPY_AND_ASSIGN(AcceleratorsCocoa); |
39 }; | 39 }; |
40 | 40 |
41 #endif // CHROME_BROWSER_COCOA_ACCELERATORS_COCOA_H_ | 41 #endif // CHROME_BROWSER_COCOA_ACCELERATORS_COCOA_H_ |
OLD | NEW |