summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-28 03:39:21 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-28 03:39:21 +0000
commit2380e35a5668205275e366dc2fd53256302a57d7 (patch)
tree0310906a583a4a041d7046fc3f8661391ded6a66 /webkit
parent309153f9d5c1a228ec712a0466a09ae00b7620bd (diff)
downloadchromium_src-2380e35a5668205275e366dc2fd53256302a57d7.zip
chromium_src-2380e35a5668205275e366dc2fd53256302a57d7.tar.gz
chromium_src-2380e35a5668205275e366dc2fd53256302a57d7.tar.bz2
Revert 123852 - Calc USB scancodes for key events (linux only for now)
This is basically reviving cl/6691066. BUG=none TEST=none Review URL: http://codereview.chromium.org/9359048 TBR=garykac@chromium.org Review URL: https://chromiumcodereview.appspot.com/9478028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webkit_glue.gypi3
-rw-r--r--webkit/plugins/ppapi/event_conversion.cc5
-rw-r--r--webkit/plugins/ppapi/usb_key_code_conversion.cc22
-rw-r--r--webkit/plugins/ppapi/usb_key_code_conversion.h27
-rw-r--r--webkit/plugins/ppapi/usb_key_code_conversion_linux.cc89
5 files changed, 3 insertions, 143 deletions
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 6f199a3..19b92f8 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -337,9 +337,6 @@
'../plugins/ppapi/resource_helper.h',
'../plugins/ppapi/string.cc',
'../plugins/ppapi/string.h',
- '../plugins/ppapi/usb_key_code_conversion.h',
- '../plugins/ppapi/usb_key_code_conversion.cc',
- '../plugins/ppapi/usb_key_code_conversion_linux.cc',
'../plugins/sad_plugin.cc',
'../plugins/sad_plugin.h',
'../plugins/webkit_plugins_export.h',
diff --git a/webkit/plugins/ppapi/event_conversion.cc b/webkit/plugins/ppapi/event_conversion.cc
index 9936ce3..4b1f2dd 100644
--- a/webkit/plugins/ppapi/event_conversion.cc
+++ b/webkit/plugins/ppapi/event_conversion.cc
@@ -18,7 +18,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/usb_key_code_conversion.h"
using ppapi::EventTimeToPPTimeTicks;
using ppapi::InputEventData;
@@ -82,7 +81,9 @@ void AppendKeyEvent(const WebInputEvent& event,
InputEventData result = GetEventWithCommonFieldsAndType(event);
result.event_modifiers = key_event.modifiers;
result.key_code = key_event.windowsKeyCode;
- result.usb_key_code = UsbKeyCodeForKeyboardEvent(key_event);
+ // TODO(garykac): Platform-specific code to convert from
+ // |key_event.nativeKeyCode| to USB key code.
+ result.usb_key_code = 0;
result_events->push_back(result);
}
diff --git a/webkit/plugins/ppapi/usb_key_code_conversion.cc b/webkit/plugins/ppapi/usb_key_code_conversion.cc
deleted file mode 100644
index a4b3f80..0000000
--- a/webkit/plugins/ppapi/usb_key_code_conversion.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "webkit/plugins/ppapi/usb_key_code_conversion.h"
-
-using WebKit::WebKeyboardEvent;
-
-namespace webkit {
-namespace ppapi {
-
-// TODO(garykac): Implement for Windows and Mac.
-#if !defined(OS_LINUX)
-
-uint32_t UsbKeyCodeForKeyboardEvent(const WebKeyboardEvent& key_event) {
- return 0;
-}
-
-#endif
-
-} // namespace ppapi
-} // namespace webkit
diff --git a/webkit/plugins/ppapi/usb_key_code_conversion.h b/webkit/plugins/ppapi/usb_key_code_conversion.h
deleted file mode 100644
index fc3da16..0000000
--- a/webkit/plugins/ppapi/usb_key_code_conversion.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_
-#define WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_
-
-#include "ppapi/c/pp_stdint.h"
-
-namespace WebKit {
-class WebKeyboardEvent;
-} // namespace WebKit
-
-namespace webkit {
-namespace ppapi {
-
-// Returns a 32-bit "USB Key Code" for the key identifier by the supplied
-// WebKeyboardEvent. The supplied event must be a KeyDown or KeyUp.
-// The code consists of the USB Page (in the high-order 16-bit word) and
-// USB Usage Id of the key. If no translation can be performed then zero
-// is returned.
-uint32_t UsbKeyCodeForKeyboardEvent(const WebKit::WebKeyboardEvent& key_event);
-
-} // namespace ppapi
-} // namespace webkit
-
-#endif // WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_
diff --git a/webkit/plugins/ppapi/usb_key_code_conversion_linux.cc b/webkit/plugins/ppapi/usb_key_code_conversion_linux.cc
deleted file mode 100644
index f10238d..0000000
--- a/webkit/plugins/ppapi/usb_key_code_conversion_linux.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "webkit/plugins/ppapi/usb_key_code_conversion.h"
-
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
-
-using WebKit::WebKeyboardEvent;
-
-namespace webkit {
-namespace ppapi {
-
-namespace {
-
-// TODO(garykac): This table covers only USB HID Boot Protocol. It should be
-// extended (e.g. with "media keys"), or derived automatically from the
-// evdev USB-to-linux keycode mapping.
-uint16_t linux_evdev_key_code_to_usb[256] = {
- // 0x00-0x0f
- 0x0000, 0x0029, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023,
- 0x0024, 0x0025, 0x0026, 0x0027, 0x002d, 0x002e, 0x002a, 0x002b,
- // 0x10-0x1f
- 0x0014, 0x001a, 0x0008, 0x0015, 0x0017, 0x001c, 0x0018, 0x000c,
- 0x0012, 0x0013, 0x002f, 0x0030, 0x0028, 0x00e0, 0x0004, 0x0016,
- // 0x20-0x2f
- 0x0007, 0x0009, 0x000a, 0x000b, 0x000d, 0x000e, 0x000f, 0x0033,
- 0x0034, 0x0035, 0x00e1, 0x0032, 0x001d, 0x001b, 0x0006, 0x0019,
- // 0x30-0x3f
- 0x0005, 0x0011, 0x0010, 0x0036, 0x0037, 0x0038, 0x00e5, 0x0055,
- 0x00e2, 0x002c, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e,
- // 0x40-0x4f
- 0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0053, 0x0047, 0x005f,
- 0x0060, 0x0061, 0x0056, 0x005c, 0x005d, 0x005e, 0x0057, 0x0059,
- // 0x50-0x5f
- 0x005a, 0x005b, 0x0062, 0x0063, 0x0000, 0x0094, 0x0064, 0x0044,
- 0x0045, 0x0087, 0x0092, 0x0093, 0x008a, 0x0088, 0x008b, 0x008c,
- // 0x60-0x6f
- 0x0058, 0x00e4, 0x0054, 0x0046, 0x00e6, 0x0000, 0x004a, 0x0052,
- 0x004b, 0x0050, 0x004f, 0x004d, 0x0051, 0x004e, 0x0049, 0x004c,
- // 0x70-0x7f
- 0x0000, 0x00ef, 0x00ee, 0x00ed, 0x0066, 0x0067, 0x0000, 0x0048,
- 0x0000, 0x0085, 0x0090, 0x0091, 0x0089, 0x00e3, 0x00e7, 0x0065,
- // 0x80-0x8f
- 0x00f3, 0x0079, 0x0076, 0x007a, 0x0077, 0x007c, 0x0074, 0x007d,
- 0x00f4, 0x007b, 0x0075, 0x0000, 0x00fb, 0x0000, 0x00f8, 0x0000,
- // 0x90-0x9f
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f0, 0x0000,
- 0x00f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f1, 0x00f2,
- // 0xa0-0xaf
- 0x0000, 0x00ec, 0x0000, 0x00eb, 0x00e8, 0x00ea, 0x00e9, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00fa, 0x0000, 0x0000,
- // 0xb0-0xbf
- 0x00f7, 0x00f5, 0x00f6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0068,
- 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070,
- // 0xc0-0xcf
- 0x0071, 0x0072, 0x0073, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- // 0xd0-0xdf
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- // 0xe0-0xef
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- // 0xf0-0xff
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-};
-
-} // anonymous namespace
-
-uint32_t UsbKeyCodeForKeyboardEvent(const WebKeyboardEvent& key_event) {
- // TODO(garykac): This code assumes that on Linux we're receiving events via
- // the Xorg "evdev" driver. We should detect "XKB" or "kbd" at run-time and
- // re-map accordingly, but that's not possible here, inside the sandbox.
- if (key_event.nativeKeyCode < 0 || key_event.nativeKeyCode > 255)
- return 0;
-
- uint32_t usbkeycode = 0;
- uint16_t code = linux_evdev_key_code_to_usb[key_event.nativeKeyCode];
- if (code != 0) {
- // Set complete scancode to be the USB keyboard page (7) and key scancode.
- usbkeycode = 0x070000 | code;
- }
- return usbkeycode;
-}
-
-} // namespace ppapi
-} // namespace webkit