| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // an unshifted mode (e.g. French AZERY layout has 'a with grave | 190 // an unshifted mode (e.g. French AZERY layout has 'a with grave |
| 191 // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the | 191 // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the |
| 192 // default zoom level), we leave VK_[0-9] alone without translation. | 192 // default zoom level), we leave VK_[0-9] alone without translation. |
| 193 wchar_t key; | 193 wchar_t key; |
| 194 if (key_code_ >= '0' && key_code_ <= '9') | 194 if (key_code_ >= '0' && key_code_ <= '9') |
| 195 key = static_cast<wchar_t>(key_code_); | 195 key = static_cast<wchar_t>(key_code_); |
| 196 else | 196 else |
| 197 key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); | 197 key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); |
| 198 shortcut += key; | 198 shortcut += key; |
| 199 #elif defined(USE_AURA) || defined(OS_MACOSX) | 199 #elif defined(USE_AURA) || defined(OS_MACOSX) |
| 200 const uint16 c = DomCodeToUsLayoutCharacter( | 200 const uint16 c = GetCharacterFromKeyCode(key_code_, false); |
| 201 UsLayoutKeyboardCodeToDomCode(key_code_), false); | |
| 202 if (c != 0) | 201 if (c != 0) |
| 203 shortcut += | 202 shortcut += |
| 204 static_cast<base::string16::value_type>(base::ToUpperASCII(c)); | 203 static_cast<base::string16::value_type>(base::ToUpperASCII(c)); |
| 205 #endif | 204 #endif |
| 206 } else { | 205 } else { |
| 207 shortcut = l10n_util::GetStringUTF16(string_id); | 206 shortcut = l10n_util::GetStringUTF16(string_id); |
| 208 } | 207 } |
| 209 | 208 |
| 210 // Checking whether the character used for the accelerator is alphanumeric. | 209 // Checking whether the character used for the accelerator is alphanumeric. |
| 211 // If it is not, then we need to adjust the string later on if the locale is | 210 // 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... |
| 267 | 266 |
| 268 // Subtracting the size of the shortcut key and 1 for the '+' sign. | 267 // Subtracting the size of the shortcut key and 1 for the '+' sign. |
| 269 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); | 268 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); |
| 270 shortcut.swap(shortcut_rtl); | 269 shortcut.swap(shortcut_rtl); |
| 271 } | 270 } |
| 272 | 271 |
| 273 return shortcut; | 272 return shortcut; |
| 274 } | 273 } |
| 275 | 274 |
| 276 } // namespace ui | 275 } // namespace ui |
| OLD | NEW |