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 "ui/events/event_constants.h" | 9 #include "ui/events/event_constants.h" |
10 #include "ui/events/keycodes/dom3/dom_code.h" | 10 #include "ui/events/keycodes/dom3/dom_code.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 // GS | 421 // GS |
422 *character = 0x1D; | 422 *character = 0x1D; |
423 *dom_key = DomKey::CHARACTER; | 423 *dom_key = DomKey::CHARACTER; |
424 *key_code = VKEY_OEM_6; | 424 *key_code = VKEY_OEM_6; |
425 return true; | 425 return true; |
426 default: | 426 default: |
427 return false; | 427 return false; |
428 } | 428 } |
429 } | 429 } |
430 | 430 |
431 DomKey CharacterToDomKey(base::char16 character) { | |
432 switch (character) { | |
433 case 0x08: | |
434 return DomKey::BACKSPACE; | |
435 case 0x09: | |
436 return DomKey::TAB; | |
437 case 0x0A: | |
438 case 0x0D: | |
Wez
2015/05/06 23:51:53
Do we really want to map both of these to Enter? T
kpschoedel
2015/05/07 16:21:33
Done.
| |
439 return DomKey::ENTER; | |
440 case 0x1B: | |
441 return DomKey::ESCAPE; | |
442 default: | |
443 return DomKey::CHARACTER; | |
444 } | |
445 } | |
446 | |
431 // Returns a Windows-based VKEY for a non-printable DOM Level 3 |key|. | 447 // Returns a Windows-based VKEY for a non-printable DOM Level 3 |key|. |
432 // The returned VKEY is non-positional (e.g. VKEY_SHIFT). | 448 // The returned VKEY is non-positional (e.g. VKEY_SHIFT). |
433 KeyboardCode NonPrintableDomKeyToKeyboardCode(DomKey dom_key) { | 449 KeyboardCode NonPrintableDomKeyToKeyboardCode(DomKey dom_key) { |
434 for (const auto& it : kDomKeyToKeyboardCodeMap) { | 450 for (const auto& it : kDomKeyToKeyboardCodeMap) { |
435 if (it.dom_key == dom_key) | 451 if (it.dom_key == dom_key) |
436 return it.key_code; | 452 return it.key_code; |
437 } | 453 } |
438 return VKEY_UNKNOWN; | 454 return VKEY_UNKNOWN; |
439 } | 455 } |
440 | 456 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 return it.dom_code; | 537 return it.dom_code; |
522 } | 538 } |
523 for (const auto& it : kFallbackKeyboardCodeToDomCodeMap) { | 539 for (const auto& it : kFallbackKeyboardCodeToDomCodeMap) { |
524 if (it.key_code == key_code) | 540 if (it.key_code == key_code) |
525 return it.dom_code; | 541 return it.dom_code; |
526 } | 542 } |
527 return DomCode::NONE; | 543 return DomCode::NONE; |
528 } | 544 } |
529 | 545 |
530 } // namespace ui | 546 } // namespace ui |
OLD | NEW |