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

Unified Diff: ui/base/accelerators/accelerator.cc

Issue 10827441: Add support for Command key for Extension Commands (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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: ui/base/accelerators/accelerator.cc
===================================================================
--- ui/base/accelerators/accelerator.cc (revision 152319)
+++ ui/base/accelerators/accelerator.cc (working copy)
@@ -82,6 +82,10 @@
return (modifiers_ & EF_ALT_DOWN) == EF_ALT_DOWN;
}
+bool Accelerator::IsCmdDown() const {
+ return (modifiers_ & EF_COMMAND_DOWN) == EF_COMMAND_DOWN;
Nico 2012/08/22 14:30:49 nit: if you say `!= 0` instead of `== EF_COMMAND_D
+}
+
string16 Accelerator::GetShortcutText() const {
int string_id = 0;
switch(key_code_) {
@@ -194,6 +198,9 @@
else if (IsAltDown())
shortcut = l10n_util::GetStringFUTF16(IDS_APP_ALT_MODIFIER, shortcut);
+ if (IsCmdDown())
+ shortcut = l10n_util::GetStringFUTF16(IDS_APP_COMMAND_MODIFIER, shortcut);
+
// For some reason, menus in Windows ignore standard Unicode directionality
// marks (such as LRE, PDF, etc.). On RTL locales, we use RTL menus and
// therefore any text we draw for the menu items is drawn in an RTL context.

Powered by Google App Engine
This is Rietveld 408576698