| 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/dom/dom_code.h" | 10 #include "ui/events/keycodes/dom/dom_code.h" |
| 11 #include "ui/events/keycodes/dom/dom_key.h" | 11 #include "ui/events/keycodes/dom/dom_key.h" |
| 12 #include "ui/events/keycodes/dom_us_layout_data.h" | 12 #include "ui/events/keycodes/dom_us_layout_data.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // This table maps a subset of |KeyboardCode| (VKEYs) to DomKey and character. | 18 // This table maps a subset of |KeyboardCode| (VKEYs) to DomKey and character. |
| 19 // Only values not otherwise handled by GetMeaningFromKeyCode() are here. | 19 // Only values not otherwise handled by GetMeaningFromKeyCode() are here. |
| 20 const struct KeyboardCodeToMeaning { | 20 const struct KeyboardCodeToMeaning { |
| 21 ui::KeyboardCode key_code; | 21 KeyboardCode key_code; |
| 22 DomKey key; | 22 DomKey key; |
| 23 base::char16 plain_character; | 23 base::char16 plain_character; |
| 24 base::char16 shift_character; | 24 base::char16 shift_character; |
| 25 } kKeyboardCodeToMeaning[] = { | 25 } kKeyboardCodeToMeaning[] = { |
| 26 {VKEY_BACK, DomKey::BACKSPACE, '\b', 0}, | 26 {VKEY_BACK, DomKey::BACKSPACE, '\b', 0}, |
| 27 {VKEY_TAB, DomKey::TAB, '\t', 0}, | 27 {VKEY_TAB, DomKey::TAB, '\t', 0}, |
| 28 {VKEY_RETURN, DomKey::ENTER, '\r', 0}, | 28 {VKEY_RETURN, DomKey::ENTER, '\r', 0}, |
| 29 {VKEY_ESCAPE, DomKey::ESCAPE, 0x1B, 0}, | 29 {VKEY_ESCAPE, DomKey::ESCAPE, 0x1B, 0}, |
| 30 {VKEY_SPACE, DomKey::CHARACTER, ' ', 0}, | 30 {VKEY_SPACE, DomKey::CHARACTER, ' ', 0}, |
| 31 {VKEY_MULTIPLY, DomKey::CHARACTER, '*', 0}, | 31 {VKEY_MULTIPLY, DomKey::CHARACTER, '*', 0}, |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 return it.dom_code; | 545 return it.dom_code; |
| 546 } | 546 } |
| 547 for (const auto& it : kFallbackKeyboardCodeToDomCodeMap) { | 547 for (const auto& it : kFallbackKeyboardCodeToDomCodeMap) { |
| 548 if (it.key_code == key_code) | 548 if (it.key_code == key_code) |
| 549 return it.dom_code; | 549 return it.dom_code; |
| 550 } | 550 } |
| 551 return DomCode::NONE; | 551 return DomCode::NONE; |
| 552 } | 552 } |
| 553 | 553 |
| 554 } // namespace ui | 554 } // namespace ui |
| OLD | NEW |