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

Unified Diff: remoting/client/native_device_keymap_ios.cc

Issue 2868383003: [CRD iOS] Send key events to the session. (Closed)
Patch Set: Clean up old key input code. No longer used. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: remoting/client/native_device_keymap_ios.cc
diff --git a/remoting/client/native_device_keymap_ios.cc b/remoting/client/native_device_keymap_ios.cc
index ebaaa71350e8799e9e3a284855fc8915106cef84..abc66f834414e90dab4ee8077a074e3f02a51fe4 100644
--- a/remoting/client/native_device_keymap_ios.cc
+++ b/remoting/client/native_device_keymap_ios.cc
@@ -201,17 +201,164 @@ const uint32_t usb_keycodes[] = {
0x0700b7, // NUMPAD_RIGHT_PAREN
};
+const remoting::KeycodeWithModifier ascii_keycode_combo[] = {
+ // [#] Numbering fields by index.
+ {0, 0}, // [0]
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0x070028, 0}, // [10] ENTER
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, // [20]
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, //
+ {0, 0}, // [30]
+ {0, 0}, //
+ {0x07002c, 0}, // SPACE
+ {0x07001e, 0x0700e1}, // !
+ {0x070034, 0x0700e1}, // "
+ {0x070020, 0x0700e1}, // #
+ {0x070021, 0x0700e1}, // $
+ {0x070022, 0x0700e1}, // %
+ {0x070024, 0x0700e1}, // &
+ {0x070034, 0}, // '
+ {0x070026, 0x0700e1}, // [40] (
+ {0x070027, 0x0700e1}, // )
+ {0x070025, 0x0700e1}, // *
+ {0x07002e, 0x0700e1}, // +
+ {0x070036, 0}, // ,
+ {0x07002d, 0}, // -
+ {0x070037, 0}, // .
+ {0x070038, 0}, // /
+ {0x070027, 0}, // 0
+ {0x07001e, 0}, // 1
+ {0x07001f, 0}, // [50] 2
+ {0x070020, 0}, // 3
+ {0x070021, 0}, // 4
+ {0x070022, 0}, // 5
+ {0x070023, 0}, // 6
+ {0x070024, 0}, // 7
+ {0x070025, 0}, // 8
+ {0x070026, 0}, // 9
+ {0x070033, 0x0700e1}, // :
+ {0x070033, 0}, // ;
+ {0x070036, 0x0700e1}, // [60] <
+ {0x07002e, 0}, // =
+ {0x070037, 0x0700e1}, // >
+ {0x070038, 0x0700e1}, // ?
+ {0x07001f, 0x0700e1}, // @
+ {0x070004, 0x0700e1}, // A
+ {0x070005, 0x0700e1}, // B
+ {0x070006, 0x0700e1}, // C
+ {0x070007, 0x0700e1}, // D
+ {0x070008, 0x0700e1}, // E
+ {0x070009, 0x0700e1}, // [70] F
+ {0x07000a, 0x0700e1}, // G
+ {0x07000b, 0x0700e1}, // H
+ {0x07000c, 0x0700e1}, // I
+ {0x07000d, 0x0700e1}, // J
+ {0x07000e, 0x0700e1}, // K
+ {0x07000f, 0x0700e1}, // L
+ {0x070010, 0x0700e1}, // M
+ {0x070011, 0x0700e1}, // N
+ {0x070012, 0x0700e1}, // O
+ {0x070013, 0x0700e1}, // [80] P
+ {0x070014, 0x0700e1}, // Q
+ {0x070015, 0x0700e1}, // R
+ {0x070016, 0x0700e1}, // S
+ {0x070017, 0x0700e1}, // T
+ {0x070018, 0x0700e1}, // U
+ {0x070019, 0x0700e1}, // V
+ {0x07001a, 0x0700e1}, // W
+ {0x07001b, 0x0700e1}, // X
+ {0x07001c, 0x0700e1}, // Y
+ {0x07001d, 0x0700e1}, // [90] Z
+ {0x07002f, 0}, // [
+ {0x070031, 0}, // BACKSLASH
+ {0x070030, 0}, // ]
+ {0x070023, 0x0700e1}, // ^
+ {0x07002d, 0x0700e1}, // _
+ {0, 0}, //
+ {0x070004, 0}, // a
+ {0x070005, 0}, // b
+ {0x070006, 0}, // c
+ {0x070007, 0}, // [100] d
+ {0x070008, 0}, // e
+ {0x070009, 0}, // f
+ {0x07000a, 0}, // g
+ {0x07000b, 0}, // h
+ {0x07000c, 0}, // i
+ {0x07000d, 0}, // j
+ {0x07000e, 0}, // k
+ {0x07000f, 0}, // l
+ {0x070010, 0}, // m
+ {0x070011, 0}, // [110] n
+ {0x070012, 0}, // o
+ {0x070013, 0}, // p
+ {0x070014, 0}, // q
+ {0x070015, 0}, // r
+ {0x070016, 0}, // s
+ {0x070017, 0}, // t
+ {0x070018, 0}, // u
+ {0x070019, 0}, // v
+ {0x07001a, 0}, // w
+ {0x07001b, 0}, // [120] x
+ {0x07001c, 0}, // y
+ {0x07001d, 0}, // z
+ {0x07002f, 0x0700e1}, // {
+ {0x070031, 0x0700e1}, // |
+ {0x070030, 0x0700e1}, // }
+ {0x070035, 0x0700e1}, // ~
+ {0, 0}, // [127]
+ {0x0700e1, 0}, // SHIFT
+ {0x07002a, 0}, // BACKSPACE
+ {0x0700e0, 0}, // CTRL
+ {0x0700e2, 0}, // ALT
+ {0x07004c, 0} // DEL
+};
+
} // namespace
namespace remoting {
uint32_t NativeDeviceKeycodeToUsbKeycode(size_t device_keycode) {
if (device_keycode >= sizeof(usb_keycodes) / sizeof(uint32_t)) {
- LOG(WARNING) << "Attempted to decode out-of-range Android keycode";
+ LOG(WARNING) << "Attempted to decode out-of-range keycode.";
return 0;
}
return usb_keycodes[device_keycode];
}
+KeycodeWithModifier AsciiToUsbKeycodeWithModifier(const char& ascii) {
+ size_t ascii_index = (size_t)ascii;
+ if (ascii_index >= sizeof(ascii_keycode_combo) / sizeof(uint32_t)) {
+ LOG(WARNING) << "Attempted to decode out-of-range ascii character.";
+ return ascii_keycode_combo[0];
+ }
+
+ return ascii_keycode_combo[ascii_index];
+}
+
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698