Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: chrome/browser/ui/cocoa/accelerators_cocoa.h

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CHROME_BROWSER_UI_COCOA_ACCELERATORS_COCOA_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_ACCELERATORS_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_ACCELERATORS_COCOA_H_ 6 #define CHROME_BROWSER_UI_COCOA_ACCELERATORS_COCOA_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include <map> 10 #include <map>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "ui/base/accelerators/accelerator.h" 14 #include "ui/base/accelerators/accelerator.h"
15 15
16 template <typename T> struct DefaultSingletonTraits; 16 namespace base {
17 template <typename T>
18 struct DefaultSingletonTraits;
19 } // namespace base
17 20
18 // This class maintains a map of command_ids to Accelerator objects (see 21 // This class maintains a map of command_ids to Accelerator objects (see
19 // chrome/app/chrome_command_ids.h). Currently, this only lists the commands 22 // chrome/app/chrome_command_ids.h). Currently, this only lists the commands
20 // that are used in the Wrench menu. 23 // that are used in the Wrench menu.
21 // 24 //
22 // It is recommended that this class be used as a singleton so that the key map 25 // It is recommended that this class be used as a singleton so that the key map
23 // isn't created multiple places. 26 // isn't created multiple places.
24 // 27 //
25 // #import "base/memory/singleton.h" 28 // #import "base/memory/singleton.h"
26 // ... 29 // ...
(...skipping 13 matching lines...) Expand all
40 const ui::Accelerator* GetAcceleratorForCommand(int command_id); 43 const ui::Accelerator* GetAcceleratorForCommand(int command_id);
41 // Searches the list of accelerators without a command_id for an accelerator 44 // Searches the list of accelerators without a command_id for an accelerator
42 // that matches the given |key_equivalent| and |modifiers|. 45 // that matches the given |key_equivalent| and |modifiers|.
43 const ui::Accelerator* GetAcceleratorForHotKey(NSString* key_equivalent, 46 const ui::Accelerator* GetAcceleratorForHotKey(NSString* key_equivalent,
44 NSUInteger modifiers) const; 47 NSUInteger modifiers) const;
45 48
46 // Returns the singleton instance. 49 // Returns the singleton instance.
47 static AcceleratorsCocoa* GetInstance(); 50 static AcceleratorsCocoa* GetInstance();
48 51
49 private: 52 private:
50 friend struct DefaultSingletonTraits<AcceleratorsCocoa>; 53 friend struct base::DefaultSingletonTraits<AcceleratorsCocoa>;
51 FRIEND_TEST_ALL_PREFIXES(AcceleratorsCocoaBrowserTest, 54 FRIEND_TEST_ALL_PREFIXES(AcceleratorsCocoaBrowserTest,
52 MappingAcceleratorsInMainMenu); 55 MappingAcceleratorsInMainMenu);
53 56
54 AcceleratorsCocoa(); 57 AcceleratorsCocoa();
55 ~AcceleratorsCocoa(); 58 ~AcceleratorsCocoa();
56 59
57 // A map from command_id to Accelerator. The accelerator is fully filled out, 60 // A map from command_id to Accelerator. The accelerator is fully filled out,
58 // and its platform_accelerator is also fully filled out. 61 // and its platform_accelerator is also fully filled out.
59 // Contains accelerators from both the wrench menu and the main menu. 62 // Contains accelerators from both the wrench menu and the main menu.
60 AcceleratorMap accelerators_; 63 AcceleratorMap accelerators_;
61 // A list of accelerators used in the main menu that have no associated 64 // A list of accelerators used in the main menu that have no associated
62 // command_id. The accelerator is fully filled out, and its 65 // command_id. The accelerator is fully filled out, and its
63 // platform_accelerator is also fully filled out. 66 // platform_accelerator is also fully filled out.
64 AcceleratorVector accelerator_vector_; 67 AcceleratorVector accelerator_vector_;
65 68
66 DISALLOW_COPY_AND_ASSIGN(AcceleratorsCocoa); 69 DISALLOW_COPY_AND_ASSIGN(AcceleratorsCocoa);
67 }; 70 };
68 71
69 #endif // CHROME_BROWSER_UI_COCOA_ACCELERATORS_COCOA_H_ 72 #endif // CHROME_BROWSER_UI_COCOA_ACCELERATORS_COCOA_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/bookmarks/enhanced_bookmark_key_service_factory.cc ('k') | chrome/browser/ui/cocoa/accelerators_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698