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

Unified Diff: chrome/common/extensions/command.cc

Issue 399783002: Begin whitelisting specific extensions for global key registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update cl with new permission "commands.accessibility". Created 6 years, 4 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
Index: chrome/common/extensions/command.cc
diff --git a/chrome/common/extensions/command.cc b/chrome/common/extensions/command.cc
index c325ad5c717da7b22dc055953a0fd10888b6149a..d2da1a33cb1d45df96c118f0f4a54f70c9e6fa70 100644
--- a/chrome/common/extensions/command.cc
+++ b/chrome/common/extensions/command.cc
@@ -77,12 +77,15 @@ ui::Accelerator ParseImpl(const std::string& accelerator,
for (size_t i = 0; i < tokens.size(); i++) {
if (tokens[i] == values::kKeyCtrl) {
modifiers |= ui::EF_CONTROL_DOWN;
- } else if (tokens[i] == values::kKeyCommand) {
- if (platform_key == values::kKeybindingPlatformMac) {
+ } else if (tokens[i] == values::kKeyCommand ||
+ tokens[i] == values::kKeySearch) {
Finnur 2014/08/21 11:18:11 This isn't right. This makes Search map over to Co
David Tseng 2014/08/21 16:03:04 Hmm...this cl was branched off of the other change
+ if (platform_key == values::kKeybindingPlatformMac ||
+ platform_key == values::kKeybindingPlatformChromeOs) {
// Either the developer specified Command+foo in the manifest for Mac or
// they specified Ctrl and it got normalized to Command (to get Ctrl on
// Mac the developer has to specify MacCtrl). Therefore we treat this
// as Command.
+ // Search maps to command on Chrome OS.
modifiers |= ui::EF_COMMAND_DOWN;
#if defined(OS_MACOSX)
} else if (platform_key == values::kKeybindingPlatformDefault) {
@@ -97,6 +100,20 @@ ui::Accelerator ParseImpl(const std::string& accelerator,
key = ui::VKEY_UNKNOWN;
break;
}
+ } else if (tokens[i] == values::kKeySearch) {
+ // Search is a special modifier only on ChromeOS and maps to 'Command'.
+ if (platform_key == values::kKeybindingPlatformChromeOs) {
+ modifiers |= ui::EF_COMMAND_DOWN;
+#if defined(OS_CHROMEOS)
+ } else if (platform_key == values::kKeybindingPlatformDefault) {
+ // Allow the search modifier here (similar to the treatment of command).
+ modifiers |= ui::EF_COMMAND_DOWN;
+#endif
+ } else {
+ // No other platform supports search.
+ key = ui::VKEY_UNKNOWN;
+ break;
+ }
Finnur 2014/08/21 11:18:10 Is this copy-pasted from an old version of a CL I
David Tseng 2014/08/21 16:17:56 Acknowledged.
} else if (tokens[i] == values::kKeyAlt) {
modifiers |= ui::EF_ALT_DOWN;
} else if (tokens[i] == values::kKeyShift) {
@@ -303,7 +320,11 @@ std::string Command::AcceleratorToString(const ui::Accelerator& accelerator) {
shortcut += values::kKeySeparator;
if (accelerator.IsCmdDown()) {
+#if defined(OS_CHROMEOS)
+ shortcut += values::kKeySearch;
+#else
shortcut += values::kKeyCommand;
+#endif
Finnur 2014/08/21 11:18:10 Yeah, it seems like this CL could use a sync up wi
David Tseng 2014/08/21 16:17:56 Acknowledged.
shortcut += values::kKeySeparator;
}

Powered by Google App Engine
This is Rietveld 408576698