OLD | NEW |
(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 CHROME_BROWSER_UI_COCOA_SYSTEM_HOTKEY_HELPER_MAC_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_SYSTEM_HOTKEY_HELPER_MAC_H_ |
| 7 |
| 8 #include "base/memory/singleton.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 |
| 11 class SystemHotkeyMap; |
| 12 |
| 13 class SystemHotkeyHelperMac { |
| 14 public: |
| 15 // Return pointer to the singleton instance for the current process. |
| 16 static SystemHotkeyHelperMac* GetInstance(); |
| 17 |
| 18 // Loads the system hot keys after a brief delay, to reduce file system access |
| 19 // immediately after launch. |
| 20 void DeferredLoadSystemHotkeys(); |
| 21 |
| 22 // Guaranteed to not be NULL. |
| 23 SystemHotkeyMap* map() { return map_.get(); } |
| 24 |
| 25 private: |
| 26 friend struct DefaultSingletonTraits<SystemHotkeyHelperMac>; |
| 27 |
| 28 SystemHotkeyHelperMac(); |
| 29 virtual ~SystemHotkeyHelperMac(); |
| 30 |
| 31 // Retrieves the relevant plist file from disk on a background thread, and |
| 32 // parses it on the main thread. |
| 33 void LoadSystemHotkeys(); |
| 34 |
| 35 scoped_ptr<SystemHotkeyMap> map_; |
| 36 base::WeakPtrFactory<SystemHotkeyHelperMac> weak_ptr_factory_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(SystemHotkeyHelperMac); |
| 39 }; |
| 40 |
| 41 #endif // CHROME_BROWSER_UI_COCOA_SYSTEM_HOTKEY_HELPER_MAC_H_ |
OLD | NEW |