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 660173002: Type conversion fixes, ui/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 if (!string_id) { 182 if (!string_id) {
183 #if defined(OS_WIN) 183 #if defined(OS_WIN)
184 // Our fallback is to try translate the key code to a regular character 184 // Our fallback is to try translate the key code to a regular character
185 // unless it is one of digits (VK_0 to VK_9). Some keyboard 185 // unless it is one of digits (VK_0 to VK_9). Some keyboard
186 // layouts have characters other than digits assigned in 186 // layouts have characters other than digits assigned in
187 // an unshifted mode (e.g. French AZERY layout has 'a with grave 187 // an unshifted mode (e.g. French AZERY layout has 'a with grave
188 // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the 188 // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the
189 // default zoom level), we leave VK_[0-9] alone without translation. 189 // default zoom level), we leave VK_[0-9] alone without translation.
190 wchar_t key; 190 wchar_t key;
191 if (key_code_ >= '0' && key_code_ <= '9') 191 if (key_code_ >= '0' && key_code_ <= '9')
192 key = key_code_; 192 key = static_cast<wchar_t>(key_code_);
193 else 193 else
194 key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); 194 key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR));
195 shortcut += key; 195 shortcut += key;
196 #elif defined(USE_AURA) || defined(OS_MACOSX) 196 #elif defined(USE_AURA) || defined(OS_MACOSX)
197 const uint16 c = GetCharacterFromKeyCode(key_code_, false); 197 const uint16 c = GetCharacterFromKeyCode(key_code_, false);
198 if (c != 0) 198 if (c != 0)
199 shortcut += 199 shortcut +=
200 static_cast<base::string16::value_type>(base::ToUpperASCII(c)); 200 static_cast<base::string16::value_type>(base::ToUpperASCII(c));
201 #endif 201 #endif
202 } else { 202 } else {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 // Subtracting the size of the shortcut key and 1 for the '+' sign. 257 // Subtracting the size of the shortcut key and 1 for the '+' sign.
258 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); 258 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1);
259 shortcut.swap(shortcut_rtl); 259 shortcut.swap(shortcut_rtl);
260 } 260 }
261 261
262 return shortcut; 262 return shortcut;
263 } 263 }
264 264
265 } // namespace ui 265 } // namespace ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc ('k') | ui/base/clipboard/clipboard_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698