| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/accelerator.h" | 5 #include "chrome/views/accelerator.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/common/l10n_util.h" | 9 #include "chrome/common/l10n_util.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 break; | 37 break; |
| 38 case VK_INSERT: | 38 case VK_INSERT: |
| 39 string_id = IDS_INSERT_KEY; | 39 string_id = IDS_INSERT_KEY; |
| 40 break; | 40 break; |
| 41 case VK_DELETE: | 41 case VK_DELETE: |
| 42 string_id = IDS_DELETE_KEY; | 42 string_id = IDS_DELETE_KEY; |
| 43 break; | 43 break; |
| 44 case VK_F1: | 44 case VK_F1: |
| 45 string_id = IDS_F1_KEY; | 45 string_id = IDS_F1_KEY; |
| 46 break; | 46 break; |
| 47 case VK_F11: |
| 48 string_id = IDS_F11_KEY; |
| 49 break; |
| 47 } | 50 } |
| 48 | 51 |
| 49 std::wstring shortcut; | 52 std::wstring shortcut; |
| 50 if (!string_id) { | 53 if (!string_id) { |
| 51 // Our fallback is to try translate the key code to a regular char. | 54 // Our fallback is to try translate the key code to a regular char. |
| 52 wchar_t key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); | 55 wchar_t key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); |
| 53 shortcut += key; | 56 shortcut += key; |
| 54 } else { | 57 } else { |
| 55 shortcut = l10n_util::GetString(string_id); | 58 shortcut = l10n_util::GetString(string_id); |
| 56 } | 59 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Subtracting the size of the shortcut key and 1 for the '+' sign. | 111 // Subtracting the size of the shortcut key and 1 for the '+' sign. |
| 109 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); | 112 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); |
| 110 shortcut.swap(shortcut_rtl); | 113 shortcut.swap(shortcut_rtl); |
| 111 } | 114 } |
| 112 | 115 |
| 113 return shortcut; | 116 return shortcut; |
| 114 } | 117 } |
| 115 | 118 |
| 116 } // namespace views | 119 } // namespace views |
| 117 | 120 |
| OLD | NEW |