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

Side by Side Diff: ui/base/accelerators/accelerator.cc

Issue 1072193004: Take GetCharacterFromKeyCode() out behind the barn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | ui/events/keycodes/keyboard_code_conversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698