| 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 "generated_resources.h" | 10 #include "generated_resources.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 break; | 34 break; |
| 35 case VK_HOME: | 35 case VK_HOME: |
| 36 string_id = IDS_HOME_KEY; | 36 string_id = IDS_HOME_KEY; |
| 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: |
| 45 string_id = IDS_F1_KEY; |
| 46 break; |
| 44 } | 47 } |
| 45 | 48 |
| 46 std::wstring shortcut; | 49 std::wstring shortcut; |
| 47 if (!string_id) { | 50 if (!string_id) { |
| 48 // Our fallback is to try translate the key code to a regular char. | 51 // Our fallback is to try translate the key code to a regular char. |
| 49 wchar_t key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); | 52 wchar_t key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); |
| 50 shortcut += key; | 53 shortcut += key; |
| 51 } else { | 54 } else { |
| 52 shortcut = l10n_util::GetString(string_id); | 55 shortcut = l10n_util::GetString(string_id); |
| 53 } | 56 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Subtracting the size of the shortcut key and 1 for the '+' sign. | 108 // Subtracting the size of the shortcut key and 1 for the '+' sign. |
| 106 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); | 109 shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1); |
| 107 shortcut.swap(shortcut_rtl); | 110 shortcut.swap(shortcut_rtl); |
| 108 } | 111 } |
| 109 | 112 |
| 110 return shortcut; | 113 return shortcut; |
| 111 } | 114 } |
| 112 | 115 |
| 113 } // namespace views | 116 } // namespace views |
| 114 | 117 |
| OLD | NEW |