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

Side by Side Diff: content/browser/cocoa/system_hotkey_helper_mac.h

Issue 370293004: mac: Load the system hotkeys after launch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from rsesek by removing gcd. Created 6 years, 5 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_COCOA_SYSTEM_HOTKEY_HELPER_MAC_H_
6 #define CONTENT_BROWSER_COCOA_SYSTEM_HOTKEY_HELPER_MAC_H_
7
8 #include "base/memory/singleton.h"
9 #include "base/memory/weak_ptr.h"
10
11 #ifdef __OBJC__
12 @class NSData;
13 #else
14 class NSData;
15 #endif
16
17 namespace content {
18
19 class SystemHotkeyMap;
20
21 class SystemHotkeyHelperMac {
Robert Sesek 2014/07/08 13:40:00 Does this need to be its own class? It's small eno
erikchen 2014/07/10 02:07:31 It would technically be possible to finesse the Sy
22 public:
23 // Return pointer to the singleton instance for the current process.
24 static SystemHotkeyHelperMac* GetInstance();
25
26 // Loads the system hot keys after a brief delay, to reduce file system access
27 // immediately after launch.
28 void DeferredLoadSystemHotkeys();
29
30 // Guaranteed to not be NULL.
31 SystemHotkeyMap* map() { return map_.get(); }
32
33 private:
34 friend struct DefaultSingletonTraits<SystemHotkeyHelperMac>;
35
36 SystemHotkeyHelperMac();
37 virtual ~SystemHotkeyHelperMac();
38
39 // Must be called from the UI thread. Invokes LoadFile from the FILE thread.
40 void LoadSystemHotkeys();
41
42 // Must be called from the FILE thread. Loads the file containing the system
43 // hotkeys into a NSData* object, and passes the result to FileDidLoad on the
44 // UI thread.
45 void LoadFile();
46
47 // Must be called from the UI thread. |data| should have a retain count of
48 // +1. This method will release |data|. Parses the system hotkeys from the
49 // plist stored in |data|.
50 void FileDidLoad(NSData* data);
51
52 scoped_ptr<SystemHotkeyMap> map_;
Robert Sesek 2014/07/08 13:40:00 Any reason this needs to be a pointer instead of j
erikchen 2014/07/10 02:07:31 Yes, for it to be a member, I'd have to move the #
53 base::WeakPtrFactory<SystemHotkeyHelperMac> weak_ptr_factory_;
54
55 DISALLOW_COPY_AND_ASSIGN(SystemHotkeyHelperMac);
56 };
57
58 } // namespace content
59
60 #endif // CONTENT_BROWSER_COCOA_SYSTEM_HOTKEY_HELPER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698