summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-21 22:42:58 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-21 22:42:58 +0000
commite1e08b4c73f6565a65e25f58374cf257ae1bbfbf (patch)
treee84f7da82738d67fc0403ea70b267db526c9e2a7
parent08b2596f531f40e2de46fc2121b490a9996c1105 (diff)
downloadchromium_src-e1e08b4c73f6565a65e25f58374cf257ae1bbfbf.zip
chromium_src-e1e08b4c73f6565a65e25f58374cf257ae1bbfbf.tar.gz
chromium_src-e1e08b4c73f6565a65e25f58374cf257ae1bbfbf.tar.bz2
Add GetUsbKeyCode _Dev interface for Pepper key events
Remove CreatePPEvent since it isn't used anywhere. BUG=none TEST=none Review URL: http://codereview.chromium.org/9353013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122892 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ppapi/api/dev/ppb_keyboard_input_event_dev.idl50
-rw-r--r--ppapi/c/dev/ppb_keyboard_input_event_dev.h74
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc10
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h16
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc2
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc35
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h11
-rw-r--r--ppapi/proxy/interface_list.cc1
-rw-r--r--ppapi/proxy/ppapi_messages.h1
-rw-r--r--ppapi/shared_impl/ppb_input_event_shared.cc9
-rw-r--r--ppapi/shared_impl/ppb_input_event_shared.h3
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h2
-rw-r--r--ppapi/thunk/ppb_input_event_api.h5
-rw-r--r--ppapi/thunk/ppb_input_event_thunk.cc26
-rw-r--r--webkit/plugins/ppapi/event_conversion.cc5
-rw-r--r--webkit/plugins/ppapi/event_conversion.h5
16 files changed, 238 insertions, 17 deletions
diff --git a/ppapi/api/dev/ppb_keyboard_input_event_dev.idl b/ppapi/api/dev/ppb_keyboard_input_event_dev.idl
new file mode 100644
index 0000000..02f20b3
--- /dev/null
+++ b/ppapi/api/dev/ppb_keyboard_input_event_dev.idl
@@ -0,0 +1,50 @@
+/* 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.
+ */
+
+/**
+ * This file defines the <code>PPB_KeyboardInputEvent_Dev</code> interface,
+ * which provides access to USB key codes that identify the physical key being
+ * pressed.
+ */
+
+label Chrome {
+ M19 = 0.1
+};
+
+/**
+ * The <code>PPB_KeyboardInputEvent_Dev</code> interface is an extension to the
+ * PPB_KeyboardInputEvent</code> interface that provides
+ */
+[version=0.1, macro="PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE"]
+interface PPB_KeyboardInputEvent_Dev {
+ /**
+ * This sets a USB key code in the given <code>PP_Resource</code>. It is
+ * intended that this method be called immediately after any call to
+ * <code>Create</code>.
+ *
+ * @param[in] key_event A <code>PP_Resource</code> created by
+ * <code>PPB_KeyboardInputEvent</code>'s <code>Create</code> method.
+ *
+ * @param[in] usb_key_code The USB key code to associate with this
+ * <code>key_event</code>.
+ *
+ * @return <code>PP_TRUE</code> if the USB key code was set successfully.
+ */
+ PP_Bool SetUsbKeyCode([in] PP_Resource key_event,
+ [in] uint32_t usb_key_code);
+
+ /**
+ * GetUsbKeyCode() returns the USB key code associated with this keyboard
+ * event.
+ *
+ * @param[in] key_event The key event for which to return the key code.
+ *
+ * @return The USB key code field for the keyboard event. If there is no
+ * USB scancode associated with this event, or if the PP_Resource does not
+ * support the PPB_InputEvent_API (i.e., it is not an input event), then
+ * a 0 is returned.
+ */
+ uint32_t GetUsbKeyCode([in] PP_Resource key_event);
+};
diff --git a/ppapi/c/dev/ppb_keyboard_input_event_dev.h b/ppapi/c/dev/ppb_keyboard_input_event_dev.h
new file mode 100644
index 0000000..c3c8fe2
--- /dev/null
+++ b/ppapi/c/dev/ppb_keyboard_input_event_dev.h
@@ -0,0 +1,74 @@
+/* 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.
+ */
+
+/* From dev/ppb_keyboard_input_event_dev.idl,
+ * modified Tue Feb 21 08:56:59 2012.
+ */
+
+#ifndef PPAPI_C_DEV_PPB_KEYBOARD_INPUT_EVENT_DEV_H_
+#define PPAPI_C_DEV_PPB_KEYBOARD_INPUT_EVENT_DEV_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_1 \
+ "PPB_KeyboardInputEvent(Dev);0.1"
+#define PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE \
+ PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_KeyboardInputEvent_Dev</code> interface,
+ * which provides access to USB key codes that identify the physical key being
+ * pressed.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * The <code>PPB_KeyboardInputEvent_Dev</code> interface is an extension to the
+ * PPB_KeyboardInputEvent</code> interface that provides
+ */
+struct PPB_KeyboardInputEvent_Dev_0_1 {
+ /**
+ * This sets a USB key code in the given <code>PP_Resource</code>. It is
+ * intended that this method be called immediately after any call to
+ * <code>Create</code>.
+ *
+ * @param[in] key_event A <code>PP_Resource</code> created by
+ * <code>PPB_KeyboardInputEvent</code>'s <code>Create</code> method.
+ *
+ * @param[in] usb_key_code The USB key code to associate with this
+ * <code>key_event</code>.
+ *
+ * @return <code>PP_TRUE</code> if the USB key code was set successfully.
+ */
+ PP_Bool (*SetUsbKeyCode)(PP_Resource key_event, uint32_t usb_key_code);
+ /**
+ * GetUsbKeyCode() returns the USB key code associated with this keyboard
+ * event.
+ *
+ * @param[in] key_event The key event for which to return the key code.
+ *
+ * @return The USB key code field for the keyboard event. If there is no
+ * USB scancode associated with this event, or if the PP_Resource does not
+ * support the PPB_InputEvent_API (i.e., it is not an input event), then
+ * a 0 is returned.
+ */
+ uint32_t (*GetUsbKeyCode)(PP_Resource key_event);
+};
+
+typedef struct PPB_KeyboardInputEvent_Dev_0_1 PPB_KeyboardInputEvent_Dev;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_DEV_PPB_KEYBOARD_INPUT_EVENT_DEV_H_ */
+
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc b/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc
index 3e3f95a..be05a67 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.cc
@@ -1,6 +1,6 @@
-// Copyright 2011 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.
+// 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 "native_client/src/shared/ppapi_proxy/input_event_data.h"
@@ -17,7 +17,9 @@ InputEventData::InputEventData()
wheel_delta(PP_MakeFloatPoint(0.0f, 0.0f)),
wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)),
wheel_scroll_by_page(PP_FALSE),
- key_code(0) {
+ key_code(0),
+ usb_key_code(0),
+ unused_padding(0) {
}
InputEventData::~InputEventData() {
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h b/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h
index c3cacc0..2f0bce2 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/input_event_data.h
@@ -1,6 +1,6 @@
-// Copyright 2011 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.
+// 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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_INPUT_EVENT_DATA_H_
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_INPUT_EVENT_DATA_H_
@@ -32,6 +32,14 @@ struct InputEventData {
PP_Bool wheel_scroll_by_page;
uint32_t key_code;
+
+ // A code for identifying the key by a USB Usage Page (upper 16-bits) and
+ // Usage Id (lower 16-bits). See the "Keyboard/Keypad Page (0x07)" of
+ // the "USB HID Usage Tables" document for encoding details.
+ uint32_t usb_key_code;
+
+ // Required for consistent 64-bit alignment on all platforms.
+ uint32_t unused_padding;
};
// Make sure that the size is consistent across platforms, so the alignment is
// consistent. Note the fields above are carefully ordered to make sure it is
@@ -39,7 +47,7 @@ struct InputEventData {
// and alignment. TODO(dmichael): This is only required because we don't pickle
// the type. As a short-cut, we memcpy it instead. It would be cleaner to
// pickle this struct.
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(InputEventData, 64);
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(InputEventData, 72);
} // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
index c1314a0..1643c4d4 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
@@ -77,6 +77,8 @@ InterfaceMapElement interface_map[] = {
{ PPB_INSTANCE_INTERFACE, PluginInstance::GetInterface(), true },
{ PPB_KEYBOARD_INPUT_EVENT_INTERFACE,
PluginInputEvent::GetKeyboardInterface(), true },
+ { PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE,
+ PluginInputEvent::GetKeyboardInterface_Dev(), true },
{ PPB_MEMORY_DEV_INTERFACE, PluginMemory::GetInterface(), true },
{ PPB_MESSAGING_INTERFACE, PluginMessaging::GetInterface(), true },
{ PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0,
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc
index 31d595c..40d4bf9 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc
@@ -115,6 +115,10 @@ PP_Bool IsInputEvent(PP_Resource resource) {
BEGIN_RESOURCE_THUNK(#function, resource_arg, error_return); \
return input_event.get()->function()
+#define IMPLEMENT_RESOURCE_THUNK1(function, resource_arg, arg, error_return) \
+ BEGIN_RESOURCE_THUNK(#function, resource_arg, error_return); \
+ return input_event.get()->function(arg)
+
PP_InputEvent_Type GetType(PP_Resource event) {
IMPLEMENT_RESOURCE_THUNK(GetType, event, PP_INPUTEVENT_TYPE_UNDEFINED);
}
@@ -260,6 +264,8 @@ PP_Bool GetWheelScrollByPage(PP_Resource wheel_event) {
IMPLEMENT_RESOURCE_THUNK(GetWheelScrollByPage, wheel_event, PP_FALSE);
}
+// Keyboard --------------------------------------------------------------------
+
PP_Resource CreateKeyboardInputEvent(PP_Instance instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
@@ -309,6 +315,17 @@ PP_Var GetCharacterText(PP_Resource character_event) {
PP_MakeUndefined());
}
+// Keyboard_Dev ----------------------------------------------------------------
+
+PP_Bool SetUsbKeyCode(PP_Resource key_event, uint32_t usb_key_code) {
+ IMPLEMENT_RESOURCE_THUNK1(SetUsbKeyCode, key_event, usb_key_code,
+ PP_FALSE);
+}
+
+uint32_t GetUsbKeyCode(PP_Resource key_event) {
+ IMPLEMENT_RESOURCE_THUNK(GetUsbKeyCode, key_event, 0);
+}
+
} // namespace
namespace ppapi_proxy {
@@ -375,6 +392,15 @@ const PPB_KeyboardInputEvent* PluginInputEvent::GetKeyboardInterface() {
return &keyboard_input_event_interface;
}
+// static
+const PPB_KeyboardInputEvent_Dev* PluginInputEvent::GetKeyboardInterface_Dev() {
+ static const PPB_KeyboardInputEvent_Dev keyboard_input_event_dev_interface = {
+ ::SetUsbKeyCode,
+ ::GetUsbKeyCode,
+ };
+ return &keyboard_input_event_dev_interface;
+}
+
PluginInputEvent::PluginInputEvent()
: character_text_(PP_MakeUndefined()) {
}
@@ -439,4 +465,13 @@ PP_Var PluginInputEvent::GetCharacterText() const {
return character_text_;
}
+PP_Bool PluginInputEvent::SetUsbKeyCode(uint32_t usb_key_code) {
+ input_event_data_.usb_key_code = usb_key_code;
+ return PP_TRUE;
+}
+
+uint32_t PluginInputEvent::GetUsbKeyCode() const {
+ return input_event_data_.usb_key_code;
+}
+
} // namespace ppapi_proxy
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h
index b56797b..0b5a6e2 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h
@@ -1,6 +1,6 @@
-// Copyright (c) 2011 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.
+// 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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INPUT_EVENT_H_
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_INPUT_EVENT_H_
@@ -8,6 +8,7 @@
#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/shared/ppapi_proxy/input_event_data.h"
#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
+#include "ppapi/c/dev/ppb_keyboard_input_event_dev.h"
#include "ppapi/c/ppb_input_event.h"
namespace ppapi_proxy {
@@ -31,6 +32,7 @@ class PluginInputEvent : public PluginResource {
static const PPB_MouseInputEvent* GetMouseInterface1_1();
static const PPB_WheelInputEvent* GetWheelInterface();
static const PPB_KeyboardInputEvent* GetKeyboardInterface();
+ static const PPB_KeyboardInputEvent_Dev* GetKeyboardInterface_Dev();
PP_InputEvent_Type GetType() const;
PP_TimeTicks GetTimeStamp() const;
@@ -48,6 +50,9 @@ class PluginInputEvent : public PluginResource {
uint32_t GetKeyCode() const;
PP_Var GetCharacterText() const;
+ PP_Bool SetUsbKeyCode(uint32_t usb_key_code);
+ uint32_t GetUsbKeyCode() const;
+
private:
IMPLEMENT_RESOURCE(PluginInputEvent);
NACL_DISALLOW_COPY_AND_ASSIGN(PluginInputEvent);
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 27563cf..55b97a0 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -16,6 +16,7 @@
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
#include "ppapi/c/dev/ppb_ime_input_event_dev.h"
+#include "ppapi/c/dev/ppb_keyboard_input_event_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
#include "ppapi/c/dev/ppb_message_loop_dev.h"
#include "ppapi/c/dev/ppb_resource_array_dev.h"
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 2c4ddd3..e6ecff9 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -130,6 +130,7 @@ IPC_STRUCT_TRAITS_BEGIN(ppapi::InputEventData)
IPC_STRUCT_TRAITS_MEMBER(wheel_ticks)
IPC_STRUCT_TRAITS_MEMBER(wheel_scroll_by_page)
IPC_STRUCT_TRAITS_MEMBER(key_code)
+ IPC_STRUCT_TRAITS_MEMBER(usb_key_code)
IPC_STRUCT_TRAITS_MEMBER(character_text)
IPC_STRUCT_TRAITS_MEMBER(composition_segment_offsets)
IPC_STRUCT_TRAITS_MEMBER(composition_target_segment)
diff --git a/ppapi/shared_impl/ppb_input_event_shared.cc b/ppapi/shared_impl/ppb_input_event_shared.cc
index 4f1a4d0..cdb0565 100644
--- a/ppapi/shared_impl/ppb_input_event_shared.cc
+++ b/ppapi/shared_impl/ppb_input_event_shared.cc
@@ -95,6 +95,15 @@ PP_Var PPB_InputEvent_Shared::GetCharacterText() {
return StringVar::StringToPPVar(data_.character_text);
}
+PP_Bool PPB_InputEvent_Shared::SetUsbKeyCode(uint32_t usb_key_code) {
+ data_.usb_key_code = usb_key_code;
+ return PP_TRUE;
+}
+
+uint32_t PPB_InputEvent_Shared::GetUsbKeyCode() {
+ return data_.usb_key_code;
+}
+
uint32_t PPB_InputEvent_Shared::GetIMESegmentNumber() {
if (data_.composition_segment_offsets.empty())
return 0;
diff --git a/ppapi/shared_impl/ppb_input_event_shared.h b/ppapi/shared_impl/ppb_input_event_shared.h
index c9ab572..c62befa 100644
--- a/ppapi/shared_impl/ppb_input_event_shared.h
+++ b/ppapi/shared_impl/ppb_input_event_shared.h
@@ -40,6 +40,7 @@ struct PPAPI_SHARED_EXPORT InputEventData {
bool wheel_scroll_by_page;
uint32_t key_code;
+ uint32_t usb_key_code;
std::string character_text;
@@ -76,6 +77,8 @@ class PPAPI_SHARED_EXPORT PPB_InputEvent_Shared
virtual PP_Bool GetWheelScrollByPage() OVERRIDE;
virtual uint32_t GetKeyCode() OVERRIDE;
virtual PP_Var GetCharacterText() OVERRIDE;
+ virtual PP_Bool SetUsbKeyCode(uint32_t usb_key_code) OVERRIDE;
+ virtual uint32_t GetUsbKeyCode() OVERRIDE;
virtual uint32_t GetIMESegmentNumber() OVERRIDE;
virtual uint32_t GetIMESegmentOffset(uint32_t index) OVERRIDE;
virtual int32_t GetIMETargetSegment() OVERRIDE;
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index b4872aa..94696e4 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -44,6 +44,8 @@ PROXIED_IFACE(PPB_Instance, PPB_CONSOLE_DEV_INTERFACE_0_1, PPB_Console_Dev_0_1)
PROXIED_IFACE(PPB_Instance, PPB_GAMEPAD_DEV_INTERFACE_0_1, PPB_Gamepad_Dev_0_1)
PROXIED_IFACE(PPB_Instance, PPB_URLUTIL_DEV_INTERFACE_0_6, PPB_URLUtil_Dev_0_6)
UNPROXIED_IFACE(PPB_Instance, PPB_ZOOM_DEV_INTERFACE_0_2, PPB_Zoom_Dev_0_2)
+PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_1,
+ PPB_KeyboardInputEvent_Dev_0_1)
UNPROXIED_IFACE(PPB_LayerCompositor, PPB_LAYER_COMPOSITOR_DEV_INTERFACE_0_2,
PPB_LayerCompositor_Dev_0_2)
PROXIED_IFACE(NoAPIName, PPB_MEMORY_DEV_INTERFACE_0_1, PPB_Memory_Dev_0_1)
diff --git a/ppapi/thunk/ppb_input_event_api.h b/ppapi/thunk/ppb_input_event_api.h
index f23c795..eda6b8e 100644
--- a/ppapi/thunk/ppb_input_event_api.h
+++ b/ppapi/thunk/ppb_input_event_api.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,6 +6,7 @@
#define PPAPI_THUNK_PPB_INPUT_EVENT_API_H_
#include "ppapi/c/dev/ppb_ime_input_event_dev.h"
+#include "ppapi/c/dev/ppb_keyboard_input_event_dev.h"
#include "ppapi/c/ppb_input_event.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
@@ -35,6 +36,8 @@ class PPAPI_THUNK_EXPORT PPB_InputEvent_API {
virtual PP_Bool GetWheelScrollByPage() = 0;
virtual uint32_t GetKeyCode() = 0;
virtual PP_Var GetCharacterText() = 0;
+ virtual PP_Bool SetUsbKeyCode(uint32_t) = 0;
+ virtual uint32_t GetUsbKeyCode() = 0;
virtual uint32_t GetIMESegmentNumber() = 0;
virtual uint32_t GetIMESegmentOffset(uint32_t index) = 0;
virtual int32_t GetIMETargetSegment() = 0;
diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc
index 388b011..78b9cd1 100644
--- a/ppapi/thunk/ppb_input_event_thunk.cc
+++ b/ppapi/thunk/ppb_input_event_thunk.cc
@@ -271,6 +271,27 @@ const PPB_KeyboardInputEvent g_ppb_keyboard_input_event_thunk = {
&GetCharacterText
};
+// _Dev interface.
+
+PP_Bool SetUsbKeyCode(PP_Resource key_event, uint32_t usb_key_code) {
+ EnterInputEvent enter(key_event, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->SetUsbKeyCode(usb_key_code);
+}
+
+uint32_t GetUsbKeyCode(PP_Resource key_event) {
+ EnterInputEvent enter(key_event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetUsbKeyCode();
+}
+
+const PPB_KeyboardInputEvent_Dev g_ppb_keyboard_input_event_dev_thunk = {
+ &SetUsbKeyCode,
+ &GetUsbKeyCode,
+};
+
// Composition -----------------------------------------------------------------
PP_Bool IsIMEInputEvent(PP_Resource resource) {
@@ -347,6 +368,11 @@ const PPB_KeyboardInputEvent_1_0* GetPPB_KeyboardInputEvent_1_0_Thunk() {
return &g_ppb_keyboard_input_event_thunk;
}
+const PPB_KeyboardInputEvent_Dev_0_1*
+ GetPPB_KeyboardInputEvent_Dev_0_1_Thunk() {
+ return &g_ppb_keyboard_input_event_dev_thunk;
+}
+
const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() {
return &g_ppb_wheel_input_event_thunk;
}
diff --git a/webkit/plugins/ppapi/event_conversion.cc b/webkit/plugins/ppapi/event_conversion.cc
index d78ad39..4b1f2dd 100644
--- a/webkit/plugins/ppapi/event_conversion.cc
+++ b/webkit/plugins/ppapi/event_conversion.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -81,6 +81,9 @@ void AppendKeyEvent(const WebInputEvent& event,
InputEventData result = GetEventWithCommonFieldsAndType(event);
result.event_modifiers = key_event.modifiers;
result.key_code = key_event.windowsKeyCode;
+ // 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/event_conversion.h b/webkit/plugins/ppapi/event_conversion.h
index ad95ebf..b9b4004 100644
--- a/webkit/plugins/ppapi/event_conversion.h
+++ b/webkit/plugins/ppapi/event_conversion.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -27,9 +27,6 @@ namespace ppapi {
// Converts the given WebKit event to one or possibly multiple PP_InputEvents.
// The generated events will be filled into the given vector. On failure, no
// events will ge generated and the vector will be empty.
-void CreatePPEvent(const WebKit::WebInputEvent& event,
- std::vector<PP_InputEvent>* pp_events);
-
void CreateInputEventData(const WebKit::WebInputEvent& event,
std::vector< ::ppapi::InputEventData >* pp_events);