| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/accelerators/accelerator.h" | 5 #include "ui/base/accelerators/accelerator.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // an unshifted mode (e.g. French AZERY layout has 'a with grave | 205 // an unshifted mode (e.g. French AZERY layout has 'a with grave |
| 206 // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the | 206 // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the |
| 207 // default zoom level), we leave VK_[0-9] alone without translation. | 207 // default zoom level), we leave VK_[0-9] alone without translation. |
| 208 wchar_t key; | 208 wchar_t key; |
| 209 if (key_code_ >= '0' && key_code_ <= '9') | 209 if (key_code_ >= '0' && key_code_ <= '9') |
| 210 key = static_cast<wchar_t>(key_code_); | 210 key = static_cast<wchar_t>(key_code_); |
| 211 else | 211 else |
| 212 key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); | 212 key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); |
| 213 shortcut += key; | 213 shortcut += key; |
| 214 #elif defined(USE_AURA) || defined(OS_MACOSX) | 214 #elif defined(USE_AURA) || defined(OS_MACOSX) |
| 215 const uint16 c = GetCharacterFromKeyCode(key_code_, false); | 215 const uint16 c = DomCodeToUsLayoutCharacter( |
| 216 UsLayoutKeyboardCodeToDomCode(key_code_), false); |
| 216 if (c != 0) | 217 if (c != 0) |
| 217 shortcut += | 218 shortcut += |
| 218 static_cast<base::string16::value_type>(base::ToUpperASCII(c)); | 219 static_cast<base::string16::value_type>(base::ToUpperASCII(c)); |
| 219 #endif | 220 #endif |
| 220 } else { | 221 } else { |
| 221 shortcut = l10n_util::GetStringUTF16(string_id); | 222 shortcut = l10n_util::GetStringUTF16(string_id); |
| 222 } | 223 } |
| 223 | 224 |
| 224 // Checking whether the character used for the accelerator is alphanumeric. | 225 // Checking whether the character used for the accelerator is alphanumeric. |
| 225 // If it is not, then we need to adjust the string later on if the locale is | 226 // If it is not, then we need to adjust the string later on if the locale is |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 282 |
| 282 // Subtracting the size of the shortcut key and 1 for the '+' sign. | 283 // Subtracting the size of the shortcut key and 1 for the '+' sign. |
| 283 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); | 284 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); |
| 284 shortcut.swap(shortcut_rtl); | 285 shortcut.swap(shortcut_rtl); |
| 285 } | 286 } |
| 286 | 287 |
| 287 return shortcut; | 288 return shortcut; |
| 288 } | 289 } |
| 289 | 290 |
| 290 } // namespace ui | 291 } // namespace ui |
| OLD | NEW |