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

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

Issue 370293004: mac: Load the system hotkeys after launch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Histograms and dchecks. 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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_SYSTEM_HOTKEY_MAP_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_SYSTEM_HOTKEY_MAP_H_
6 #define CHROME_BROWSER_UI_COCOA_SYSTEM_HOTKEY_MAP_H_ 6 #define CHROME_BROWSER_UI_COCOA_SYSTEM_HOTKEY_MAP_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Cocoa/Cocoa.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/gtest_prod_util.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 13
13 struct SystemHotkey; 14 struct SystemHotkey;
14 15
15 // Maintains a listing of all OSX user modifiable hotkeys. e.g. (cmd + `) 16 // Maintains a listing of all OSX user modifiable hotkeys. e.g. (cmd + `)
16 class SystemHotkeyMap { 17 class SystemHotkeyMap {
17 public: 18 public:
18 SystemHotkeyMap(); 19 SystemHotkeyMap();
19 ~SystemHotkeyMap(); 20 ~SystemHotkeyMap();
20 21
21 // Parses the property list data commonly stored at 22 // Parses the property list data commonly stored at
22 // ~/Library/Preferences/com.apple.symbolichotkeys.plist 23 // ~/Library/Preferences/com.apple.symbolichotkeys.plist
23 // Returns false on encountering an irrecoverable error. 24 // Returns false on encountering an irrecoverable error.
24 // Can be called multiple times. Only the results from the most recent 25 // Can be called multiple times. Only the results from the most recent
25 // invocation are stored. 26 // invocation are stored.
26 bool ParseData(NSData* data); 27 bool ParseData(NSData* data);
27 28
28 // Whether the hotkey has been reserved by the user. 29 // Whether the event corresponds to a hotkey that has been reserved by the
29 bool IsHotkeyReserved(int key_code, int modifiers); 30 // system.
31 bool IsEventReserved(NSEvent* event) const;
30 32
31 private: 33 private:
34 FRIEND_TEST_ALL_PREFIXES(SystemHotkeyMapTest, Parse);
35
36 // Whether the hotkey has been reserved by the user.
37 bool IsHotkeyReserved(int key_code, int modifiers) const;
38
32 // Create at least one record of a hotkey that is reserved by the user. 39 // Create at least one record of a hotkey that is reserved by the user.
33 // Certain system hotkeys automatically reserve multiple key combinations. 40 // Certain system hotkeys automatically reserve multiple key combinations.
34 void ReserveHotkey(int key_code, int modifiers, NSString* system_effect); 41 void ReserveHotkey(int key_code, int modifiers, NSString* system_effect);
35 42
36 // Create a record of a hotkey that is reserved by the user. 43 // Create a record of a hotkey that is reserved by the user.
37 void ReserveHotkey(int key_code, int modifiers); 44 void ReserveHotkey(int key_code, int modifiers);
38 45
39 std::vector<SystemHotkey> system_hotkeys_; 46 std::vector<SystemHotkey> system_hotkeys_;
40 47
41 DISALLOW_COPY_AND_ASSIGN(SystemHotkeyMap); 48 DISALLOW_COPY_AND_ASSIGN(SystemHotkeyMap);
42 }; 49 };
43 50
44 #endif // CHROME_BROWSER_UI_COCOA_SYSTEM_HOTKEY_MAP_H_ 51 #endif // CHROME_BROWSER_UI_COCOA_SYSTEM_HOTKEY_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698