OLD | NEW |
---|---|
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 CONTENT_BROWSER_COCOA_SYSTEM_HOTKEY_MAP_H_ |
6 #define CHROME_BROWSER_UI_COCOA_SYSTEM_HOTKEY_MAP_H_ | 6 #define CONTENT_BROWSER_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" |
13 #include "content/common/content_export.h" | |
14 | |
15 namespace content { | |
12 | 16 |
13 struct SystemHotkey; | 17 struct SystemHotkey; |
14 | 18 |
15 // Maintains a listing of all OSX user modifiable hotkeys. e.g. (cmd + `) | 19 // Maintains a listing of all OSX user modifiable hotkeys. e.g. (cmd + `) |
Robert Sesek
2014/07/08 13:40:01
To what end…?
| |
16 class SystemHotkeyMap { | 20 class CONTENT_EXPORT SystemHotkeyMap { |
17 public: | 21 public: |
18 SystemHotkeyMap(); | 22 SystemHotkeyMap(); |
19 ~SystemHotkeyMap(); | 23 ~SystemHotkeyMap(); |
20 | 24 |
21 // Parses the property list data commonly stored at | 25 // Parses the property list data commonly stored at |
22 // ~/Library/Preferences/com.apple.symbolichotkeys.plist | 26 // ~/Library/Preferences/com.apple.symbolichotkeys.plist |
23 // Returns false on encountering an irrecoverable error. | 27 // Returns false on encountering an irrecoverable error. |
24 // Can be called multiple times. Only the results from the most recent | 28 // Can be called multiple times. Only the results from the most recent |
25 // invocation are stored. | 29 // invocation are stored. |
26 bool ParseData(NSData* data); | 30 bool ParseData(NSData* data); |
27 | 31 |
28 // Whether the hotkey has been reserved by the user. | 32 // Whether the event corresponds to a hotkey that has been reserved by the |
29 bool IsHotkeyReserved(int key_code, int modifiers); | 33 // system. |
34 bool IsEventReserved(NSEvent* event) const; | |
30 | 35 |
31 private: | 36 private: |
37 FRIEND_TEST_ALL_PREFIXES(SystemHotkeyMapTest, Parse); | |
38 | |
39 // Whether the hotkey has been reserved by the user. | |
40 bool IsHotkeyReserved(int key_code, int modifiers) const; | |
41 | |
32 // Create at least one record of a hotkey that is reserved by the user. | 42 // Create at least one record of a hotkey that is reserved by the user. |
33 // Certain system hotkeys automatically reserve multiple key combinations. | 43 // Certain system hotkeys automatically reserve multiple key combinations. |
34 void ReserveHotkey(int key_code, int modifiers, NSString* system_effect); | 44 void ReserveHotkey(int key_code, int modifiers, NSString* system_effect); |
35 | 45 |
36 // Create a record of a hotkey that is reserved by the user. | 46 // Create a record of a hotkey that is reserved by the user. |
37 void ReserveHotkey(int key_code, int modifiers); | 47 void ReserveHotkey(int key_code, int modifiers); |
38 | 48 |
39 std::vector<SystemHotkey> system_hotkeys_; | 49 std::vector<SystemHotkey> system_hotkeys_; |
40 | 50 |
41 DISALLOW_COPY_AND_ASSIGN(SystemHotkeyMap); | 51 DISALLOW_COPY_AND_ASSIGN(SystemHotkeyMap); |
42 }; | 52 }; |
43 | 53 |
44 #endif // CHROME_BROWSER_UI_COCOA_SYSTEM_HOTKEY_MAP_H_ | 54 } // namespace content |
55 | |
56 #endif // CONTENT_BROWSER_COCOA_SYSTEM_HOTKEY_MAP_H_ | |
OLD | NEW |