From 32432cc770eb49a612d37d89fee2e98fb0ba6422 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 4 Oct 2013 22:59:05 +0800 Subject: [PATCH] Convert "Command" to "Ctrl" in accelerators on non-Mac. --- browser/ui/accelerator_util.cc | 9 +++------ docs/api/browser/menu-item.md | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/browser/ui/accelerator_util.cc b/browser/ui/accelerator_util.cc index 438149e..88a5101 100644 --- a/browser/ui/accelerator_util.cc +++ b/browser/ui/accelerator_util.cc @@ -15,10 +15,9 @@ namespace accelerator_util { namespace { -// For Mac, we convert "Ctrl" to "Command" and "MacCtrl" to "Ctrl". Other -// platforms leave the shortcut untouched. +// Convert "Command" to "Ctrl" on non-Mac std::string NormalizeShortcutSuggestion(const std::string& suggestion) { -#if !defined(OS_MACOSX) +#if defined(OS_MACOSX) return suggestion; #endif @@ -26,9 +25,7 @@ std::string NormalizeShortcutSuggestion(const std::string& suggestion) { std::vector tokens; base::SplitString(suggestion, '+', &tokens); for (size_t i = 0; i < tokens.size(); i++) { - if (tokens[i] == "Ctrl") - tokens[i] = "Command"; - else if (tokens[i] == "MacCtrl") + if (tokens[i] == "Command") tokens[i] = "Ctrl"; } return JoinString(tokens, '+'); diff --git a/docs/api/browser/menu-item.md b/docs/api/browser/menu-item.md index ec54743..df922e1 100644 --- a/docs/api/browser/menu-item.md +++ b/docs/api/browser/menu-item.md @@ -23,5 +23,5 @@ ## Notes on accelerator -On OS X, the `Ctrl` would automatically translated to `Command`, if you really -want `Ctrl` on OS X, you should use `MacCtrl`. +On Linux and Windows, the `Command` would be translated to `Ctrl`, so usually +you can use `Command` for most of the commands. -- 2.7.4