| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/keycodes/keyboard_code_conversion.h" | 5 #include "ui/base/keycodes/keyboard_code_conversion.h" |
| 6 | 6 |
| 7 #include "ui/base/events.h" | 7 #include "ui/base/events.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // ctrl-Enter maps to \x0A (Line feed) | 49 // ctrl-Enter maps to \x0A (Line feed) |
| 50 case VKEY_RETURN: | 50 case VKEY_RETURN: |
| 51 return 0x0A; | 51 return 0x0A; |
| 52 // Returns 0 for all other keys to avoid inputting unexpected chars. | 52 // Returns 0 for all other keys to avoid inputting unexpected chars. |
| 53 default: | 53 default: |
| 54 return 0; | 54 return 0; |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 // For IME support |
| 60 if (key_code == ui::VKEY_PROCESSKEY) |
| 61 return 0xE5; |
| 62 |
| 59 // Normal characters | 63 // Normal characters |
| 60 if (key_code >= VKEY_0 && key_code <= VKEY_9) { | 64 if (key_code >= VKEY_0 && key_code <= VKEY_9) { |
| 61 return shift ? ")!@#$%^&*("[key_code - VKEY_0] : | 65 return shift ? ")!@#$%^&*("[key_code - VKEY_0] : |
| 62 static_cast<uint16>(key_code); | 66 static_cast<uint16>(key_code); |
| 63 } else if (key_code >= VKEY_NUMPAD0 && key_code <= VKEY_NUMPAD9) { | 67 } else if (key_code >= VKEY_NUMPAD0 && key_code <= VKEY_NUMPAD9) { |
| 64 return key_code - VKEY_NUMPAD0 + '0'; | 68 return key_code - VKEY_NUMPAD0 + '0'; |
| 65 } | 69 } |
| 66 | 70 |
| 67 switch (key_code) { | 71 switch (key_code) { |
| 68 case VKEY_TAB: | 72 case VKEY_TAB: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 case VKEY_OEM_6: | 106 case VKEY_OEM_6: |
| 103 return shift ? '}' : ']'; | 107 return shift ? '}' : ']'; |
| 104 case VKEY_OEM_7: | 108 case VKEY_OEM_7: |
| 105 return shift ? '"' : '\''; | 109 return shift ? '"' : '\''; |
| 106 default: | 110 default: |
| 107 return 0; | 111 return 0; |
| 108 } | 112 } |
| 109 } | 113 } |
| 110 | 114 |
| 111 } // namespace ui | 115 } // namespace ui |
| OLD | NEW |