| 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/events/keycodes/keyboard_code_conversion.h" | 5 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/events/event_constants.h" | 10 #include "ui/events/event_constants.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool DomCodeToControlCharacter(DomCode dom_code, | 64 bool DomCodeToControlCharacter(DomCode dom_code, |
| 65 int flags, | 65 int flags, |
| 66 DomKey* dom_key, | 66 DomKey* dom_key, |
| 67 KeyboardCode* key_code) { | 67 KeyboardCode* key_code) { |
| 68 if ((flags & EF_CONTROL_DOWN) == 0) | 68 if ((flags & EF_CONTROL_DOWN) == 0) |
| 69 return false; | 69 return false; |
| 70 | 70 |
| 71 int code = static_cast<int>(dom_code); | 71 int code = static_cast<int>(dom_code); |
| 72 const int kKeyA = static_cast<int>(DomCode::KEY_A); | 72 const int kKeyA = static_cast<int>(DomCode::US_A); |
| 73 // Control-A - Control-Z map to 0x01 - 0x1A. | 73 // Control-A - Control-Z map to 0x01 - 0x1A. |
| 74 if (code >= kKeyA && code <= static_cast<int>(DomCode::KEY_Z)) { | 74 if (code >= kKeyA && code <= static_cast<int>(DomCode::US_Z)) { |
| 75 *dom_key = DomKey::FromCharacter(code - kKeyA + 1); | 75 *dom_key = DomKey::FromCharacter(code - kKeyA + 1); |
| 76 *key_code = static_cast<KeyboardCode>(code - kKeyA + VKEY_A); | 76 *key_code = static_cast<KeyboardCode>(code - kKeyA + VKEY_A); |
| 77 switch (dom_code) { | 77 switch (dom_code) { |
| 78 case DomCode::KEY_H: | 78 case DomCode::US_H: |
| 79 *key_code = VKEY_BACK; | 79 *key_code = VKEY_BACK; |
| 80 break; | 80 break; |
| 81 case DomCode::KEY_I: | 81 case DomCode::US_I: |
| 82 *key_code = VKEY_TAB; | 82 *key_code = VKEY_TAB; |
| 83 break; | 83 break; |
| 84 case DomCode::KEY_M: | 84 case DomCode::US_M: |
| 85 *key_code = VKEY_RETURN; | 85 *key_code = VKEY_RETURN; |
| 86 break; | 86 break; |
| 87 default: | 87 default: |
| 88 break; | 88 break; |
| 89 } | 89 } |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 if (flags & EF_SHIFT_DOWN) { | 93 if (flags & EF_SHIFT_DOWN) { |
| 94 switch (dom_code) { | 94 switch (dom_code) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 return VKEY_UNKNOWN; | 259 return VKEY_UNKNOWN; |
| 260 } | 260 } |
| 261 | 261 |
| 262 KeyboardCode DomCodeToUsLayoutNonLocatedKeyboardCode(DomCode dom_code) { | 262 KeyboardCode DomCodeToUsLayoutNonLocatedKeyboardCode(DomCode dom_code) { |
| 263 return LocatedToNonLocatedKeyboardCode( | 263 return LocatedToNonLocatedKeyboardCode( |
| 264 DomCodeToUsLayoutKeyboardCode(dom_code)); | 264 DomCodeToUsLayoutKeyboardCode(dom_code)); |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace ui | 267 } // namespace ui |
| OLD | NEW |