| 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/event_constants.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 | 10 |
| 11 uint16 GetCharacterFromKeyCode(KeyboardCode key_code, int flags) { | 11 uint16 GetCharacterFromKeyCode(KeyboardCode key_code, int flags) { |
| 12 const bool ctrl = (flags & EF_CONTROL_DOWN) != 0; | 12 const bool ctrl = (flags & EF_CONTROL_DOWN) != 0; |
| 13 const bool shift = (flags & EF_SHIFT_DOWN) != 0; | 13 const bool shift = (flags & EF_SHIFT_DOWN) != 0; |
| 14 const bool upper = shift ^ ((flags & EF_CAPS_LOCK_DOWN) != 0); | 14 const bool upper = shift ^ ((flags & EF_CAPS_LOCK_DOWN) != 0); |
| 15 | 15 |
| 16 // Following Windows behavior to map ctrl-a ~ ctrl-z to \x01 ~ \x1A. | 16 // Following Windows behavior to map ctrl-a ~ ctrl-z to \x01 ~ \x1A. |
| 17 if (key_code >= VKEY_A && key_code <= VKEY_Z) | 17 if (key_code >= VKEY_A && key_code <= VKEY_Z) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 case VKEY_OEM_6: | 106 case VKEY_OEM_6: |
| 107 return shift ? '}' : ']'; | 107 return shift ? '}' : ']'; |
| 108 case VKEY_OEM_7: | 108 case VKEY_OEM_7: |
| 109 return shift ? '"' : '\''; | 109 return shift ? '"' : '\''; |
| 110 default: | 110 default: |
| 111 return 0; | 111 return 0; |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace ui | 115 } // namespace ui |
| OLD | NEW |