Home | History | Annotate | Download | only in remoting
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Source of data in this file:
      6 //  1. ui/events/keycodes/dom4/keycode_converter_data.h
      7 //  2. ui/events/keycodes/keyboard_codes.h
      8 //  3. third_party/WebKit/Source/core/platform/chromium/KeyboardCodes.h
      9 #ifndef CHROME_TEST_REMOTING_KEY_CODE_MAP_H_
     10 #define CHROME_TEST_REMOTING_KEY_CODE_MAP_H_
     11 
     12 #include "base/basictypes.h"
     13 #include "ui/events/keycodes/keyboard_codes.h"
     14 
     15 namespace remoting {
     16 
     17 typedef struct {
     18   // The character typed as a result of the key press without shift.
     19   char lower_char;
     20 
     21   // The character typed as a result of the key press with shift.
     22   char upper_char;
     23 
     24   // The UIEvents (aka: DOM4Events) |code| value as defined in:
     25   // https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm
     26   const char* code;
     27 
     28   // The (Windows) virtual keyboard code.
     29   ui::KeyboardCode vkey_code;
     30 } KeyCodeMap;
     31 
     32 // The mapping between the native scan codes and the characters are based
     33 // on US keyboard layout.
     34 const KeyCodeMap key_code_map[] = {
     35 
     36 //lower UPPER Code  KeyboardCode
     37   {'a', 'A', "KeyA", ui::VKEY_A},  // aA
     38   {'b', 'B', "KeyB", ui::VKEY_B},  // bB
     39   {'c', 'C', "KeyC", ui::VKEY_C},  // cC
     40   {'d', 'D', "KeyD", ui::VKEY_D},  // dD
     41   {'e', 'E', "KeyE", ui::VKEY_E},  // eE
     42   {'f', 'F', "KeyF", ui::VKEY_F},  // fF
     43   {'g', 'G', "KeyG", ui::VKEY_G},  // gG
     44   {'h', 'H', "KeyH", ui::VKEY_H},  // hH
     45   {'i', 'I', "KeyI", ui::VKEY_I},  // iI
     46   {'j', 'J', "KeyJ", ui::VKEY_J},  // jJ
     47   {'k', 'K', "KeyK", ui::VKEY_K},  // kK
     48   {'l', 'L', "KeyL", ui::VKEY_L},  // lL
     49   {'m', 'M', "KeyM", ui::VKEY_M},  // mM
     50   {'n', 'N', "KeyN", ui::VKEY_N},  // nN
     51   {'o', 'O', "KeyO", ui::VKEY_O},  // oO
     52   {'p', 'P', "KeyP", ui::VKEY_P},  // pP
     53   {'q', 'Q', "KeyQ", ui::VKEY_Q},  // qQ
     54   {'r', 'R', "KeyR", ui::VKEY_R},  // rR
     55   {'s', 'S', "KeyS", ui::VKEY_S},  // sS
     56   {'t', 'T', "KeyT", ui::VKEY_T},  // tT
     57   {'u', 'U', "KeyU", ui::VKEY_U},  // uU
     58   {'v', 'V', "KeyV", ui::VKEY_V},  // vV
     59   {'w', 'W', "KeyW", ui::VKEY_W},  // wW
     60   {'x', 'X', "KeyX", ui::VKEY_X},  // xX
     61   {'y', 'Y', "KeyY", ui::VKEY_Y},  // yY
     62   {'z', 'Z', "KeyZ", ui::VKEY_Z},  // zZ
     63   {'1', '1', "Digit1", ui::VKEY_0},  // 1!
     64   {'2', '2', "Digit2", ui::VKEY_1},  // 2@
     65   {'3', '3', "Digit3", ui::VKEY_2},  // 3#
     66   {'4', '4', "Digit4", ui::VKEY_3},  // 4$
     67   {'5', '5', "Digit5", ui::VKEY_4},  // 5%
     68   {'6', '6', "Digit6", ui::VKEY_5},  // 6^
     69   {'7', '7', "Digit7", ui::VKEY_6},  // 7&
     70   {'8', '8', "Digit8", ui::VKEY_7},  // 8*
     71   {'9', '9', "Digit9", ui::VKEY_8},  // 9(
     72   {'0', '0', "Digit0", ui::VKEY_9},  // 0)
     73 
     74   {'\n', '\n', "Enter", ui::VKEY_RETURN},  // Return
     75   { 0 ,  0 , "Escape", ui::VKEY_UNKNOWN},  // Escape
     76   {'\b', '\b', "Backspace", ui::VKEY_BACK},  // Backspace
     77   {'\t', '\t', "Tab", ui::VKEY_TAB},  // Tab
     78   {' ', ' ', "Space", ui::VKEY_SPACE},  // Spacebar
     79   {'-', '_', "Minus", ui::VKEY_OEM_MINUS},  // -_
     80   {'=', '+', "Equal", ui::VKEY_OEM_PLUS},  // =+
     81   {'[', '{', "BracketLeft", ui::VKEY_OEM_4},  // [{
     82   {']', '}', "BracketRight", ui::VKEY_OEM_6},  // ]}
     83   {'\\', '|', "Backslash", ui::VKEY_OEM_5},  // \| (US keyboard only)
     84   {';', ':', "Semicolon", ui::VKEY_OEM_1},  // ;:
     85   {'\'', '\"', "Quote", ui::VKEY_OEM_7},  // '"
     86   {'`', '~', "Backquote", ui::VKEY_OEM_3},  // `~
     87   {',', '<', "Comma", ui::VKEY_OEM_COMMA},  // ,<
     88   {'.', '>', "Period", ui::VKEY_OEM_PERIOD},  // .>
     89   {'/', '?', "Slash", ui::VKEY_OEM_2},  // /?
     90 };
     91 
     92 }  // namespace remoting
     93 
     94 #endif  // CHROME_TEST_REMOTING_KEY_CODE_MAP_H_
     95