Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: ui/events/keycodes/keyboard_code_conversion.cc

Issue 929053004: [KeyboardEvent] Add embedder APIs to translate between Dom |key| enum and strings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: UnitTest updated as MakeKeyboardEvent now adds a value to differentiate Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 KeyboardCode key_code; 21 ui::KeyboardCode key_code;
Wez 2015/07/25 23:12:26 ?
Habib Virji 2015/07/31 16:17:29 Removed
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
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
OLDNEW
« ui/events/keycodes/dom_us_layout_data.h ('K') | « ui/events/keycodes/dom_us_layout_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698