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

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: 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..036d57b4c493c87956febda663a91f79c155d892 100644
--- a/content/browser/cocoa/system_hotkey_map.mm
+++ b/content/browser/cocoa/system_hotkey_map.mm
@@ -33,6 +33,17 @@ NSString* StringForKey(NSDictionary* dict, NSString* key) {
return ObjectForKey(dict, key, [NSString class]);
}
+NSDictionary* kDefaultSymbolicHotKeys = @{
+ // Default Window switch key binding: Command + `
+ @"27" : @{
+ @"enabled" : @YES,
+ @"value" : @{
+ @"type" : @"standard",
+ @"parameters" : @[ @96, @50, @1048576 ],
erikchen 2016/04/01 03:55:12 Where did these numbers come from?
chongz 2016/04/01 19:47:18 They come from my local file, replaced with meanin
+ }
+ }
+};
+
} // namespace
#pragma mark - SystemHotkey
@@ -75,11 +86,17 @@ 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;
+ // Safe for user disabled hotkeys. If a hotkey was disabled it will have
erikchen 2016/04/01 03:55:11 I don't understand your comment. I think you are t
chongz 2016/04/01 19:47:18 Done. I was trying to emphasize that not only modi
+ // |enabled| set to "NO" instead of removed from |user_hotkey_dictionaries|.
erikchen 2016/04/01 03:55:11 Add a link to https://bugs.chromium.org/p/chromium
chongz 2016/04/01 19:47:18 Done.
+ NSMutableDictionary* hotkey_dictionaries =
+ [kDefaultSymbolicHotKeys mutableCopy];
erikchen 2016/04/01 03:55:12 You are leaking a reference. Use scoped_nsobject.
chongz 2016/04/01 19:47:17 Done.
+ [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