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

Unified Diff: content/browser/cocoa/system_hotkey_map.mm

Issue 1853533002: Add default hotkey dictionary for com.apple.symbolichotkeys.plist (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avi's review Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/cocoa/system_hotkey_map_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/cocoa/system_hotkey_map.mm
diff --git a/content/browser/cocoa/system_hotkey_map.mm b/content/browser/cocoa/system_hotkey_map.mm
index da04fa8b8442c66fa5c47410c25adeb2190fd3df..6ee40574420c48b0cc6c39f3bd7ebf000ac0e2c2 100644
--- a/content/browser/cocoa/system_hotkey_map.mm
+++ b/content/browser/cocoa/system_hotkey_map.mm
@@ -4,6 +4,10 @@
#import "content/browser/cocoa/system_hotkey_map.h"
+#import <Carbon/Carbon.h>
+
+#include "base/mac/scoped_nsobject.h"
+
#pragma mark - NSDictionary Helper Functions
namespace {
@@ -75,11 +79,32 @@ bool SystemHotkeyMap::ParseDictionary(NSDictionary* dictionary) {
if (!dictionary)
return false;
- NSDictionary* hotkey_dictionaries =
+ NSDictionary* user_hotkey_dictionaries =
DictionaryForKey(dictionary, @"AppleSymbolicHotKeys");
- if (!hotkey_dictionaries)
+ if (!user_hotkey_dictionaries)
return false;
+ // Start with a dictionary of default OS X hotkeys that are not necessarily
+ // listed in com.apple.symbolichotkeys.plist, but should still be handled as
+ // reserved.
+ // If the user has overridden or disabled any of these hotkeys,
+ // -NSMutableDictionary addEntriesFromDictionary:] will ensure that the new
+ // values are used.
+ // See https://crbug.com/145062#c8
+ base::scoped_nsobject<NSMutableDictionary> hotkey_dictionaries([@{
+ // Default Window switch key binding: Command + `
+ // Note: The first parameter @96 is not used by |SystemHotkeyMap|.
+ @"27" : @{
+ @"enabled" : @YES,
+ @"value" : @{
+ @"type" : @"standard",
+ @"parameters" :
+ @[ @96 /* unused */, @(kVK_ANSI_Grave), @(NSCommandKeyMask) ],
+ }
+ }
+ } mutableCopy]);
+ [hotkey_dictionaries addEntriesFromDictionary:user_hotkey_dictionaries];
+
for (NSString* hotkey_system_effect in [hotkey_dictionaries allKeys]) {
if (![hotkey_system_effect isKindOfClass:[NSString class]])
continue;
« no previous file with comments | « no previous file | content/browser/cocoa/system_hotkey_map_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698