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

Unified Diff: chrome/browser/extensions/api/commands/command_service.cc

Issue 105713005: Mac-specific implementation of the GlobalShortcutListener class that (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable test for now Created 7 years 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 | chrome/browser/extensions/extension_commands_global_registry_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/commands/command_service.cc
diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc
index 37f51b3ba177e2bfbf99118eda8b53dcae9accf1..99993bde467a3414bb3082beecee7eee83cf7eae 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -79,10 +79,17 @@ bool InitialBindingsHaveBeenAssigned(
}
bool IsWhitelistedGlobalShortcut(const extensions::Command& command) {
+ // Non-global shortcuts are always allowed.
if (!command.global())
return true;
+ // Global shortcuts must be (Ctrl|Command)-Shift-[0-9].
+#if defined OS_MACOSX
+ if (!command.accelerator().IsCmdDown())
+ return false;
+#else
if (!command.accelerator().IsCtrlDown())
return false;
+#endif
if (!command.accelerator().IsShiftDown())
return false;
return (command.accelerator().key_code() >= ui::VKEY_0 &&
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_commands_global_registry_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698