summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-27 19:06:35 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-27 19:06:35 +0000
commit9e1abbc82e974719b757844402ec74aba660a3c8 (patch)
tree383f4cd93f6534ec1d55ba1d8a9dec2d46475372 /ppapi
parentf4821400355c5126dda788043ef6e148c067d160 (diff)
downloadchromium_src-9e1abbc82e974719b757844402ec74aba660a3c8.zip
chromium_src-9e1abbc82e974719b757844402ec74aba660a3c8.tar.gz
chromium_src-9e1abbc82e974719b757844402ec74aba660a3c8.tar.bz2
Move PPB_KeyboardInputEvent.GetCode to stable.
Remove GetUsbKeycode and SetUsbKeyCode since they were earlier verisons of this API that are not being used anywhere. Remove all the KeyboardEvent _Dev files since they will no longer be used once GetCode is moved out. BUG=286359,284774,275049 R=binji@chromium.org, dcheng@chromium.org, dmichael@chromium.org Review URL: https://codereview.chromium.org/112983005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/dev/ppb_keyboard_input_event_dev.idl60
-rw-r--r--ppapi/api/ppb_input_event.idl61
-rw-r--r--ppapi/c/dev/ppb_keyboard_input_event_dev.h84
-rw-r--r--ppapi/c/ppb_input_event.h45
-rw-r--r--ppapi/cpp/input_event.cc88
-rw-r--r--ppapi/cpp/input_event.h37
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c79
-rw-r--r--ppapi/proxy/interface_list.cc1
-rw-r--r--ppapi/proxy/ppapi_messages.h1
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc18
-rw-r--r--ppapi/proxy/resource_creation_proxy.h10
-rw-r--r--ppapi/shared_impl/ppb_input_event_shared.cc19
-rw-r--r--ppapi/shared_impl/ppb_input_event_shared.h6
-rw-r--r--ppapi/tests/test_ime_input_event.cc4
-rw-r--r--ppapi/tests/test_input_event.cc15
-rw-r--r--ppapi/tests/test_input_event.h2
-rw-r--r--ppapi/tests/test_scrollbar.cc3
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h2
-rw-r--r--ppapi/thunk/interfaces_ppb_public_stable.h2
-rw-r--r--ppapi/thunk/ppb_input_event_api.h3
-rw-r--r--ppapi/thunk/ppb_input_event_thunk.cc88
-rw-r--r--ppapi/thunk/resource_creation_api.h10
22 files changed, 349 insertions, 289 deletions
diff --git a/ppapi/api/dev/ppb_keyboard_input_event_dev.idl b/ppapi/api/dev/ppb_keyboard_input_event_dev.idl
deleted file mode 100644
index 0612b99..0000000
--- a/ppapi/api/dev/ppb_keyboard_input_event_dev.idl
+++ /dev/null
@@ -1,60 +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.
- */
-
-/**
- * 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 {
- M31 = 0.2
-};
-
-/**
- * The <code>PPB_KeyboardInputEvent_Dev</code> interface is an extension to the
- * PPB_KeyboardInputEvent</code> interface that provides
- */
-[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);
-
- /**
- * GetCode() returns the DOM |code| field for this keyboard event, as
- * defined by the UI Events spec: http://www.w3.org/TR/uievents/
- *
- * @param[in] key_event The key event for which to return the key code.
- *
- * @return The string that contains the DOM |code| for the keyboard event.
- */
- PP_Var GetCode([in] PP_Resource key_event);
-};
diff --git a/ppapi/api/ppb_input_event.idl b/ppapi/api/ppb_input_event.idl
index 2ed2e25..d871a76 100644
--- a/ppapi/api/ppb_input_event.idl
+++ b/ppapi/api/ppb_input_event.idl
@@ -9,7 +9,8 @@
label Chrome {
M13 = 1.0,
- M14 = 1.1
+ M14 = 1.1,
+ M34 = 1.2
};
/**
@@ -312,7 +313,7 @@ interface PPB_InputEvent {
* the page.
*
* Note that synthetic mouse events will be generated from touch events if
- * (and only if) the you do not request touch events.
+ * (and only if) you do not request touch events.
*
* When requesting input events through this function, the events will be
* delivered and <i>not</i> bubbled to the page. This means that even if you
@@ -733,8 +734,8 @@ interface PPB_KeyboardInputEvent {
* <code>PP_InputEvent_Modifier</code> flags.
*
* @param[in] key_code This value reflects the DOM KeyboardEvent
- * <code>keyCode</code> field. Chrome populates this with the Windows-style
- * Virtual Key code of the key.
+ * <code>keyCode</code> field, which is the Windows-style Virtual Key
+ * code of the key.
*
* @param[in] character_text This value represents the typed character as a
* UTF-8 string.
@@ -742,6 +743,7 @@ interface PPB_KeyboardInputEvent {
* @return A <code>PP_Resource</code> containing the new keyboard input
* event.
*/
+ [deprecate=1.2]
PP_Resource Create([in] PP_Instance instance,
[in] PP_InputEvent_Type type,
[in] PP_TimeTicks time_stamp,
@@ -750,6 +752,45 @@ interface PPB_KeyboardInputEvent {
[in] PP_Var character_text);
/**
+ * Creates a keyboard input event with the given parameters. Normally you
+ * will get a keyboard event passed through the HandleInputEvent and will not
+ * need to create them, but some applications may want to create their own
+ * for internal use. The type must be one of the keyboard event types.
+ *
+ * @param[in] instance The instance for which this event occurred.
+ *
+ * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of
+ * input event.
+ *
+ * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
+ * when the event occurred.
+ *
+ * @param[in] modifiers A bit field combination of the
+ * <code>PP_InputEvent_Modifier</code> flags.
+ *
+ * @param[in] key_code This value reflects the DOM KeyboardEvent
+ * <code>keyCode</code> field, which is the Windows-style Virtual Key
+ * code of the key.
+ *
+ * @param[in] character_text This value represents the typed character as a
+ * UTF-8 string.
+ *
+ * @param[in] code This value represents the DOM3 |code| string that
+ * corresponds to the physical key being pressed.
+ *
+ * @return A <code>PP_Resource</code> containing the new keyboard input
+ * event.
+ */
+ [version=1.2]
+ PP_Resource Create([in] PP_Instance instance,
+ [in] PP_InputEvent_Type type,
+ [in] PP_TimeTicks time_stamp,
+ [in] uint32_t modifiers,
+ [in] uint32_t key_code,
+ [in] PP_Var character_text,
+ [in] PP_Var code);
+
+ /**
* IsKeyboardInputEvent() determines if a resource is a keyboard event.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to an event.
@@ -781,6 +822,18 @@ interface PPB_KeyboardInputEvent {
* undefined var.
*/
PP_Var GetCharacterText([in] PP_Resource character_event);
+
+ /**
+ * GetCode() returns the DOM |code| field for this keyboard event, as
+ * defined in the DOM3 Events spec:
+ * http://www.w3.org/TR/DOM-Level-3-Events/
+ *
+ * @param[in] key_event The key event for which to return the key code.
+ *
+ * @return The string that contains the DOM |code| for the keyboard event.
+ */
+ [version=1.2]
+ PP_Var GetCode([in] PP_Resource key_event);
};
[assert_size(4)]
diff --git a/ppapi/c/dev/ppb_keyboard_input_event_dev.h b/ppapi/c/dev/ppb_keyboard_input_event_dev.h
deleted file mode 100644
index a921bd9..0000000
--- a/ppapi/c/dev/ppb_keyboard_input_event_dev.h
+++ /dev/null
@@ -1,84 +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.
- */
-
-/* From dev/ppb_keyboard_input_event_dev.idl,
- * modified Fri Sep 6 10:00:04 2013.
- */
-
-#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"
-#include "ppapi/c/pp_var.h"
-
-#define PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_2 \
- "PPB_KeyboardInputEvent(Dev);0.2"
-#define PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE \
- PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_2
-
-/**
- * @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_2 {
- /**
- * 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);
- /**
- * GetCode() returns the DOM |code| field for this keyboard event, as
- * defined by the UI Events spec: http://www.w3.org/TR/uievents/
- *
- * @param[in] key_event The key event for which to return the key code.
- *
- * @return The string that contains the DOM |code| for the keyboard event.
- */
- struct PP_Var (*GetCode)(PP_Resource key_event);
-};
-
-typedef struct PPB_KeyboardInputEvent_Dev_0_2 PPB_KeyboardInputEvent_Dev;
-/**
- * @}
- */
-
-#endif /* PPAPI_C_DEV_PPB_KEYBOARD_INPUT_EVENT_DEV_H_ */
-
diff --git a/ppapi/c/ppb_input_event.h b/ppapi/c/ppb_input_event.h
index 2624f0b..257d568 100644
--- a/ppapi/c/ppb_input_event.h
+++ b/ppapi/c/ppb_input_event.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_input_event.idl modified Tue Jul 23 19:23:51 2013. */
+/* From ppb_input_event.idl modified Mon Dec 16 15:35:15 2013. */
#ifndef PPAPI_C_PPB_INPUT_EVENT_H_
#define PPAPI_C_PPB_INPUT_EVENT_H_
@@ -29,8 +29,9 @@
#define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0
#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 "PPB_KeyboardInputEvent;1.0"
+#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_2 "PPB_KeyboardInputEvent;1.2"
#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \
- PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0
+ PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_2
#define PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 "PPB_TouchInputEvent;1.0"
#define PPB_TOUCH_INPUT_EVENT_INTERFACE PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0
@@ -330,7 +331,7 @@ struct PPB_InputEvent_1_0 {
* the page.
*
* Note that synthetic mouse events will be generated from touch events if
- * (and only if) the you do not request touch events.
+ * (and only if) you do not request touch events.
*
* When requesting input events through this function, the events will be
* delivered and <i>not</i> bubbled to the page. This means that even if you
@@ -695,7 +696,7 @@ typedef struct PPB_WheelInputEvent_1_0 PPB_WheelInputEvent;
* The <code>PPB_KeyboardInputEvent</code> interface contains pointers to
* several functions related to keyboard input events.
*/
-struct PPB_KeyboardInputEvent_1_0 {
+struct PPB_KeyboardInputEvent_1_2 {
/**
* Creates a keyboard input event with the given parameters. Normally you
* will get a keyboard event passed through the HandleInputEvent and will not
@@ -710,16 +711,19 @@ struct PPB_KeyboardInputEvent_1_0 {
* @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
* when the event occurred.
*
- * @param[in] modifiers A bit field combination of the
+ * @param[in] modifiers A bit field combination of the
* <code>PP_InputEvent_Modifier</code> flags.
*
* @param[in] key_code This value reflects the DOM KeyboardEvent
- * <code>keyCode</code> field. Chrome populates this with the Windows-style
- * Virtual Key code of the key.
+ * <code>keyCode</code> field, which is the Windows-style Virtual Key
+ * code of the key.
*
* @param[in] character_text This value represents the typed character as a
* UTF-8 string.
*
+ * @param[in] code This value represents the DOM3 |code| string that
+ * corresponds to the physical key being pressed.
+ *
* @return A <code>PP_Resource</code> containing the new keyboard input
* event.
*/
@@ -728,7 +732,8 @@ struct PPB_KeyboardInputEvent_1_0 {
PP_TimeTicks time_stamp,
uint32_t modifiers,
uint32_t key_code,
- struct PP_Var character_text);
+ struct PP_Var character_text,
+ struct PP_Var code);
/**
* IsKeyboardInputEvent() determines if a resource is a keyboard event.
*
@@ -759,9 +764,31 @@ struct PPB_KeyboardInputEvent_1_0 {
* undefined var.
*/
struct PP_Var (*GetCharacterText)(PP_Resource character_event);
+ /**
+ * GetCode() returns the DOM |code| field for this keyboard event, as
+ * defined in the DOM3 Events spec:
+ * http://www.w3.org/TR/DOM-Level-3-Events/
+ *
+ * @param[in] key_event The key event for which to return the key code.
+ *
+ * @return The string that contains the DOM |code| for the keyboard event.
+ */
+ struct PP_Var (*GetCode)(PP_Resource key_event);
};
-typedef struct PPB_KeyboardInputEvent_1_0 PPB_KeyboardInputEvent;
+typedef struct PPB_KeyboardInputEvent_1_2 PPB_KeyboardInputEvent;
+
+struct PPB_KeyboardInputEvent_1_0 {
+ PP_Resource (*Create)(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ struct PP_Var character_text);
+ PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource);
+ uint32_t (*GetKeyCode)(PP_Resource key_event);
+ struct PP_Var (*GetCharacterText)(PP_Resource character_event);
+};
/**
* @}
*/
diff --git a/ppapi/cpp/input_event.cc b/ppapi/cpp/input_event.cc
index e4e0003..93385bf 100644
--- a/ppapi/cpp/input_event.cc
+++ b/ppapi/cpp/input_event.cc
@@ -19,6 +19,10 @@ template <> const char* interface_name<PPB_InputEvent_1_0>() {
return PPB_INPUT_EVENT_INTERFACE_1_0;
}
+template <> const char* interface_name<PPB_KeyboardInputEvent_1_2>() {
+ return PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_2;
+}
+
template <> const char* interface_name<PPB_KeyboardInputEvent_1_0>() {
return PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0;
}
@@ -189,11 +193,19 @@ KeyboardInputEvent::KeyboardInputEvent() : InputEvent() {
}
KeyboardInputEvent::KeyboardInputEvent(const InputEvent& event) : InputEvent() {
- // Type check the input event before setting it.
- if (!has_interface<PPB_KeyboardInputEvent_1_0>())
- return;
- if (get_interface<PPB_KeyboardInputEvent_1_0>()->IsKeyboardInputEvent(
- event.pp_resource())) {
+ PP_Bool is_keyboard_event = PP_FALSE;
+
+ if (has_interface<PPB_KeyboardInputEvent_1_2>()) {
+ is_keyboard_event =
+ get_interface<PPB_KeyboardInputEvent_1_2>()->IsKeyboardInputEvent(
+ event.pp_resource());
+ } else if (has_interface<PPB_KeyboardInputEvent_1_0>()) {
+ is_keyboard_event =
+ get_interface<PPB_KeyboardInputEvent_1_0>()->IsKeyboardInputEvent(
+ event.pp_resource());
+ }
+
+ if (PP_ToBool(is_keyboard_event)) {
Module::Get()->core()->AddRefResource(event.pp_resource());
PassRefFromConstructor(event.pp_resource());
}
@@ -205,26 +217,66 @@ KeyboardInputEvent::KeyboardInputEvent(const InstanceHandle& instance,
uint32_t modifiers,
uint32_t key_code,
const Var& character_text) {
- // Type check the input event before setting it.
- if (!has_interface<PPB_KeyboardInputEvent_1_0>())
- return;
- PassRefFromConstructor(get_interface<PPB_KeyboardInputEvent_1_0>()->Create(
- instance.pp_instance(), type, time_stamp, modifiers, key_code,
- character_text.pp_var()));
+ if (has_interface<PPB_KeyboardInputEvent_1_2>()) {
+ PassRefFromConstructor(get_interface<PPB_KeyboardInputEvent_1_2>()->Create(
+ instance.pp_instance(), type, time_stamp, modifiers, key_code,
+ character_text.pp_var(), Var().pp_var()));
+ } else if (has_interface<PPB_KeyboardInputEvent_1_0>()) {
+ PassRefFromConstructor(get_interface<PPB_KeyboardInputEvent_1_0>()->Create(
+ instance.pp_instance(), type, time_stamp, modifiers, key_code,
+ character_text.pp_var()));
+ }
+}
+
+KeyboardInputEvent::KeyboardInputEvent(const InstanceHandle& instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ const Var& character_text,
+ const Var& code) {
+ if (has_interface<PPB_KeyboardInputEvent_1_2>()) {
+ PassRefFromConstructor(get_interface<PPB_KeyboardInputEvent_1_2>()->Create(
+ instance.pp_instance(), type, time_stamp, modifiers, key_code,
+ character_text.pp_var(), code.pp_var()));
+ } else if (has_interface<PPB_KeyboardInputEvent_1_0>()) {
+ PassRefFromConstructor(get_interface<PPB_KeyboardInputEvent_1_0>()->Create(
+ instance.pp_instance(), type, time_stamp, modifiers, key_code,
+ character_text.pp_var()));
+ }
}
uint32_t KeyboardInputEvent::GetKeyCode() const {
- if (!has_interface<PPB_KeyboardInputEvent_1_0>())
- return 0;
- return get_interface<PPB_KeyboardInputEvent_1_0>()->GetKeyCode(pp_resource());
+ if (has_interface<PPB_KeyboardInputEvent_1_2>()) {
+ return get_interface<PPB_KeyboardInputEvent_1_2>()->GetKeyCode(
+ pp_resource());
+ } else if (has_interface<PPB_KeyboardInputEvent_1_0>()) {
+ return get_interface<PPB_KeyboardInputEvent_1_0>()->GetKeyCode(
+ pp_resource());
+ }
+ return 0;
}
Var KeyboardInputEvent::GetCharacterText() const {
- if (!has_interface<PPB_KeyboardInputEvent_1_0>())
- return Var();
- return Var(PASS_REF,
- get_interface<PPB_KeyboardInputEvent_1_0>()->GetCharacterText(
+ if (has_interface<PPB_KeyboardInputEvent_1_2>()) {
+ return Var(PASS_REF,
+ get_interface<PPB_KeyboardInputEvent_1_2>()->GetCharacterText(
+ pp_resource()));
+ } else if (has_interface<PPB_KeyboardInputEvent_1_0>()) {
+ return Var(PASS_REF,
+ get_interface<PPB_KeyboardInputEvent_1_0>()->GetCharacterText(
pp_resource()));
+ }
+ return Var();
+}
+
+Var KeyboardInputEvent::GetCode() const {
+ if (has_interface<PPB_KeyboardInputEvent_1_2>()) {
+ return Var(PASS_REF,
+ get_interface<PPB_KeyboardInputEvent_1_2>()->GetCode(
+ pp_resource()));
+ }
+ return Var();
}
// TouchInputEvent ------------------------------------------------------------
diff --git a/ppapi/cpp/input_event.h b/ppapi/cpp/input_event.h
index 6965184..f9641ef 100644
--- a/ppapi/cpp/input_event.h
+++ b/ppapi/cpp/input_event.h
@@ -288,6 +288,37 @@ class KeyboardInputEvent : public InputEvent {
uint32_t key_code,
const Var& character_text);
+ /// Constructs a keyboard input even from the given parameters.
+ ///
+ /// @param[in] instance The instance for which this event occurred.
+ ///
+ /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of
+ /// input event.
+ ///
+ /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
+ /// when the event occurred.
+ ///
+ /// @param[in] modifiers A bit field combination of the
+ /// <code>PP_InputEvent_Modifier</code> flags.
+ ///
+ /// @param[in] key_code This value reflects the DOM KeyboardEvent
+ /// <code>keyCode</code> field. Chrome populates this with the Windows-style
+ /// Virtual Key code of the key.
+ ///
+ /// @param[in] character_text This value represents the typed character as a
+ /// UTF-8 string.
+ ///
+ /// @param[in] code This value reflects the DOM KeyboardEvent
+ /// <code>code</code> field, which identifies the physical key associated
+ /// with the event.
+ KeyboardInputEvent(const InstanceHandle& instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ const Var& character_text,
+ const Var& code);
+
/// Returns the DOM keyCode field for the keyboard event.
/// Chrome populates this with the Windows-style Virtual Key code of the key.
uint32_t GetKeyCode() const;
@@ -298,6 +329,12 @@ class KeyboardInputEvent : public InputEvent {
/// input events. For non-character input events the return value will be an
/// undefined var.
Var GetCharacterText() const;
+
+ /// Returns the DOM |code| for the keyboard event.
+ //
+ /// @return A string var representing a physical key that was pressed to
+ /// generate this event.
+ Var GetCode() const;
};
class TouchInputEvent : public InputEvent {
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index defd2ad..16567e4 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -18,7 +18,6 @@
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/dev/ppb_graphics_2d_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_printing_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
@@ -156,6 +155,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseInputEvent_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseInputEvent_1_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_2;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MediaStreamAudioTrack_0_1;
@@ -190,7 +190,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooser_Dev_0_6;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Font_Dev_0_6;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_2;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_7;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6;
@@ -929,6 +928,35 @@ static void Pnacl_M13_PPB_KeyboardInputEvent_GetCharacterText(struct PP_Var* _st
/* End wrapper methods for PPB_KeyboardInputEvent_1_0 */
+/* Begin wrapper methods for PPB_KeyboardInputEvent_1_2 */
+
+static PP_Resource Pnacl_M34_PPB_KeyboardInputEvent_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, uint32_t key_code, struct PP_Var* character_text, struct PP_Var* code) {
+ const struct PPB_KeyboardInputEvent_1_2 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_2.real_iface;
+ return iface->Create(instance, type, time_stamp, modifiers, key_code, *character_text, *code);
+}
+
+static PP_Bool Pnacl_M34_PPB_KeyboardInputEvent_IsKeyboardInputEvent(PP_Resource resource) {
+ const struct PPB_KeyboardInputEvent_1_2 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_2.real_iface;
+ return iface->IsKeyboardInputEvent(resource);
+}
+
+static uint32_t Pnacl_M34_PPB_KeyboardInputEvent_GetKeyCode(PP_Resource key_event) {
+ const struct PPB_KeyboardInputEvent_1_2 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_2.real_iface;
+ return iface->GetKeyCode(key_event);
+}
+
+static void Pnacl_M34_PPB_KeyboardInputEvent_GetCharacterText(struct PP_Var* _struct_result, PP_Resource character_event) {
+ const struct PPB_KeyboardInputEvent_1_2 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_2.real_iface;
+ *_struct_result = iface->GetCharacterText(character_event);
+}
+
+static void Pnacl_M34_PPB_KeyboardInputEvent_GetCode(struct PP_Var* _struct_result, PP_Resource key_event) {
+ const struct PPB_KeyboardInputEvent_1_2 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_2.real_iface;
+ *_struct_result = iface->GetCode(key_event);
+}
+
+/* End wrapper methods for PPB_KeyboardInputEvent_1_2 */
+
/* Begin wrapper methods for PPB_TouchInputEvent_1_0 */
static PP_Resource Pnacl_M13_PPB_TouchInputEvent_Create(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers) {
@@ -2123,25 +2151,6 @@ static void Pnacl_M21_PPB_IMEInputEvent_Dev_GetSelection(PP_Resource ime_event,
/* End wrapper methods for PPB_IMEInputEvent_Dev_0_2 */
-/* Begin wrapper methods for PPB_KeyboardInputEvent_Dev_0_2 */
-
-static PP_Bool Pnacl_M31_PPB_KeyboardInputEvent_Dev_SetUsbKeyCode(PP_Resource key_event, uint32_t usb_key_code) {
- const struct PPB_KeyboardInputEvent_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_2.real_iface;
- return iface->SetUsbKeyCode(key_event, usb_key_code);
-}
-
-static uint32_t Pnacl_M31_PPB_KeyboardInputEvent_Dev_GetUsbKeyCode(PP_Resource key_event) {
- const struct PPB_KeyboardInputEvent_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_2.real_iface;
- return iface->GetUsbKeyCode(key_event);
-}
-
-static void Pnacl_M31_PPB_KeyboardInputEvent_Dev_GetCode(struct PP_Var* _struct_result, PP_Resource key_event) {
- const struct PPB_KeyboardInputEvent_Dev_0_2 *iface = Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_2.real_iface;
- *_struct_result = iface->GetCode(key_event);
-}
-
-/* End wrapper methods for PPB_KeyboardInputEvent_Dev_0_2 */
-
/* Not generating wrapper methods for PPB_Memory_Dev_0_1 */
/* Begin wrapper methods for PPB_Printing_Dev_0_7 */
@@ -4328,6 +4337,14 @@ static struct PPB_KeyboardInputEvent_1_0 Pnacl_Wrappers_PPB_KeyboardInputEvent_1
.GetCharacterText = (struct PP_Var (*)(PP_Resource character_event))&Pnacl_M13_PPB_KeyboardInputEvent_GetCharacterText
};
+static struct PPB_KeyboardInputEvent_1_2 Pnacl_Wrappers_PPB_KeyboardInputEvent_1_2 = {
+ .Create = (PP_Resource (*)(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, uint32_t key_code, struct PP_Var character_text, struct PP_Var code))&Pnacl_M34_PPB_KeyboardInputEvent_Create,
+ .IsKeyboardInputEvent = (PP_Bool (*)(PP_Resource resource))&Pnacl_M34_PPB_KeyboardInputEvent_IsKeyboardInputEvent,
+ .GetKeyCode = (uint32_t (*)(PP_Resource key_event))&Pnacl_M34_PPB_KeyboardInputEvent_GetKeyCode,
+ .GetCharacterText = (struct PP_Var (*)(PP_Resource character_event))&Pnacl_M34_PPB_KeyboardInputEvent_GetCharacterText,
+ .GetCode = (struct PP_Var (*)(PP_Resource key_event))&Pnacl_M34_PPB_KeyboardInputEvent_GetCode
+};
+
static struct PPB_TouchInputEvent_1_0 Pnacl_Wrappers_PPB_TouchInputEvent_1_0 = {
.Create = (PP_Resource (*)(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers))&Pnacl_M13_PPB_TouchInputEvent_Create,
.AddTouchPoint = (void (*)(PP_Resource touch_event, PP_TouchListType list, const struct PP_TouchPoint* point))&Pnacl_M13_PPB_TouchInputEvent_AddTouchPoint,
@@ -4678,12 +4695,6 @@ static struct PPB_IMEInputEvent_Dev_0_2 Pnacl_Wrappers_PPB_IMEInputEvent_Dev_0_2
.GetSelection = (void (*)(PP_Resource ime_event, uint32_t* start, uint32_t* end))&Pnacl_M21_PPB_IMEInputEvent_Dev_GetSelection
};
-static struct PPB_KeyboardInputEvent_Dev_0_2 Pnacl_Wrappers_PPB_KeyboardInputEvent_Dev_0_2 = {
- .SetUsbKeyCode = (PP_Bool (*)(PP_Resource key_event, uint32_t usb_key_code))&Pnacl_M31_PPB_KeyboardInputEvent_Dev_SetUsbKeyCode,
- .GetUsbKeyCode = (uint32_t (*)(PP_Resource key_event))&Pnacl_M31_PPB_KeyboardInputEvent_Dev_GetUsbKeyCode,
- .GetCode = (struct PP_Var (*)(PP_Resource key_event))&Pnacl_M31_PPB_KeyboardInputEvent_Dev_GetCode
-};
-
/* Not generating wrapper interface for PPB_Memory_Dev_0_1 */
static struct PPB_Printing_Dev_0_7 Pnacl_Wrappers_PPB_Printing_Dev_0_7 = {
@@ -5333,6 +5344,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0 =
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_2 = {
+ .iface_macro = PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_2,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_KeyboardInputEvent_1_2,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0 = {
.iface_macro = PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_TouchInputEvent_1_0,
@@ -5537,12 +5554,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2 = {
.real_iface = NULL
};
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_2 = {
- .iface_macro = PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_2,
- .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_KeyboardInputEvent_Dev_0_2,
- .real_iface = NULL
-};
-
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Printing_Dev_0_7 = {
.iface_macro = PPB_PRINTING_DEV_INTERFACE_0_7,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Printing_Dev_0_7,
@@ -5861,6 +5872,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_MouseInputEvent_1_1,
&Pnacl_WrapperInfo_PPB_WheelInputEvent_1_0,
&Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_0,
+ &Pnacl_WrapperInfo_PPB_KeyboardInputEvent_1_2,
&Pnacl_WrapperInfo_PPB_TouchInputEvent_1_0,
&Pnacl_WrapperInfo_PPB_IMEInputEvent_1_0,
&Pnacl_WrapperInfo_PPB_MediaStreamAudioTrack_0_1,
@@ -5894,7 +5906,6 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_Font_Dev_0_6,
&Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_1,
&Pnacl_WrapperInfo_PPB_IMEInputEvent_Dev_0_2,
- &Pnacl_WrapperInfo_PPB_KeyboardInputEvent_Dev_0_2,
&Pnacl_WrapperInfo_PPB_Printing_Dev_0_7,
&Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1,
&Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6,
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index e4a697a..4044b27b 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -17,7 +17,6 @@
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
#include "ppapi/c/dev/ppb_graphics_2d_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_opengles2ext_dev.h"
#include "ppapi/c/dev/ppb_printing_dev.h"
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index f3cd9d0..1cd3e14 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -278,7 +278,6 @@ 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(code)
IPC_STRUCT_TRAITS_MEMBER(character_text)
IPC_STRUCT_TRAITS_MEMBER(composition_segment_offsets)
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index db14611..a4dbeec 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -107,16 +107,30 @@ PP_Resource ResourceCreationProxy::CreateIMEInputEvent(
segment_offsets, target_segment, selection_start, selection_end);
}
-PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent(
+PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent_1_0(
PP_Instance instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
uint32_t modifiers,
uint32_t key_code,
struct PP_Var character_text) {
+ PP_Var code = StringVar::StringToPPVar("");
return PPB_InputEvent_Shared::CreateKeyboardInputEvent(
OBJECT_IS_PROXY, instance, type, time_stamp, modifiers, key_code,
- character_text);
+ character_text, code);
+}
+
+PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent_1_2(
+ PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ struct PP_Var character_text,
+ struct PP_Var code) {
+ return PPB_InputEvent_Shared::CreateKeyboardInputEvent(
+ OBJECT_IS_PROXY, instance, type, time_stamp, modifiers, key_code,
+ character_text, code);
}
PP_Resource ResourceCreationProxy::CreateMouseInputEvent(
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index 418fb8d..4719c4a 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -52,13 +52,21 @@ class ResourceCreationProxy : public InterfaceProxy,
int32_t target_segment,
uint32_t selection_start,
uint32_t selection_end) OVERRIDE;
- virtual PP_Resource CreateKeyboardInputEvent(
+ virtual PP_Resource CreateKeyboardInputEvent_1_0(
PP_Instance instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
uint32_t modifiers,
uint32_t key_code,
PP_Var character_text) OVERRIDE;
+ virtual PP_Resource CreateKeyboardInputEvent_1_2(
+ PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ PP_Var character_text,
+ PP_Var code) OVERRIDE;
virtual PP_Resource CreateMouseInputEvent(
PP_Instance instance,
PP_InputEvent_Type type,
diff --git a/ppapi/shared_impl/ppb_input_event_shared.cc b/ppapi/shared_impl/ppb_input_event_shared.cc
index c837e5a..88b9793 100644
--- a/ppapi/shared_impl/ppb_input_event_shared.cc
+++ b/ppapi/shared_impl/ppb_input_event_shared.cc
@@ -23,7 +23,6 @@ InputEventData::InputEventData()
wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)),
wheel_scroll_by_page(false),
key_code(0),
- usb_key_code(0),
code(),
character_text(),
composition_target_segment(-1),
@@ -100,15 +99,6 @@ 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;
-}
-
PP_Var PPB_InputEvent_Shared::GetCode() {
return StringVar::StringToPPVar(data_.code);
}
@@ -257,7 +247,8 @@ PP_Resource PPB_InputEvent_Shared::CreateKeyboardInputEvent(
PP_TimeTicks time_stamp,
uint32_t modifiers,
uint32_t key_code,
- struct PP_Var character_text) {
+ struct PP_Var character_text,
+ struct PP_Var code) {
if (event_type != PP_INPUTEVENT_TYPE_RAWKEYDOWN &&
event_type != PP_INPUTEVENT_TYPE_KEYDOWN &&
event_type != PP_INPUTEVENT_TYPE_KEYUP &&
@@ -275,6 +266,12 @@ PP_Resource PPB_InputEvent_Shared::CreateKeyboardInputEvent(
return 0;
data.character_text = text_str->value();
}
+ if (code.type == PP_VARTYPE_STRING) {
+ StringVar* code_str = StringVar::FromPPVar(code);
+ if (!code_str)
+ return 0;
+ data.code = code_str->value();
+ }
return (new PPB_InputEvent_Shared(type, instance, data))->GetReference();
}
diff --git a/ppapi/shared_impl/ppb_input_event_shared.h b/ppapi/shared_impl/ppb_input_event_shared.h
index 623d997..ad467b4 100644
--- a/ppapi/shared_impl/ppb_input_event_shared.h
+++ b/ppapi/shared_impl/ppb_input_event_shared.h
@@ -41,7 +41,6 @@ struct PPAPI_SHARED_EXPORT InputEventData {
bool wheel_scroll_by_page;
uint32_t key_code;
- uint32_t usb_key_code;
// The key event's |code| attribute as defined in:
// http://www.w3.org/TR/uievents/
@@ -86,8 +85,6 @@ 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 PP_Var GetCode() OVERRIDE;
virtual uint32_t GetIMESegmentNumber() OVERRIDE;
virtual uint32_t GetIMESegmentOffset(uint32_t index) OVERRIDE;
@@ -118,7 +115,8 @@ class PPAPI_SHARED_EXPORT PPB_InputEvent_Shared
PP_TimeTicks time_stamp,
uint32_t modifiers,
uint32_t key_code,
- struct PP_Var character_text);
+ struct PP_Var character_text,
+ struct PP_Var code);
static PP_Resource CreateMouseInputEvent(
ResourceObjectType type,
PP_Instance instance,
diff --git a/ppapi/tests/test_ime_input_event.cc b/ppapi/tests/test_ime_input_event.cc
index fdb51c2..d4da130 100644
--- a/ppapi/tests/test_ime_input_event.cc
+++ b/ppapi/tests/test_ime_input_event.cc
@@ -194,7 +194,8 @@ pp::InputEvent TestImeInputEvent::CreateCharEvent(const std::string& text) {
100, // time_stamp
0, // modifiers
0, // keycode
- pp::Var(text));
+ pp::Var(text),
+ pp::Var());
}
void TestImeInputEvent::GetFocusBySimulatingMouseClick() {
@@ -421,4 +422,3 @@ std::string TestImeInputEvent::TestImeUnawareCancel() {
ASSERT_TRUE(expected_events_.empty());
PASS();
}
-
diff --git a/ppapi/tests/test_input_event.cc b/ppapi/tests/test_input_event.cc
index 34ad680..4fd0eda 100644
--- a/ppapi/tests/test_input_event.cc
+++ b/ppapi/tests/test_input_event.cc
@@ -17,6 +17,7 @@ namespace {
const uint32_t kSpaceChar = 0x20;
const char* kSpaceString = " ";
+const char* kSpaceCode = "Space";
#define FINISHED_WAITING_MESSAGE "TEST_INPUT_EVENT_FINISHED_WAITING"
@@ -140,14 +141,16 @@ pp::InputEvent TestInputEvent::CreateWheelEvent() {
}
pp::InputEvent TestInputEvent::CreateKeyEvent(PP_InputEvent_Type type,
- uint32_t key_code) {
+ uint32_t key_code,
+ const std::string& code) {
return pp::KeyboardInputEvent(
instance_,
type,
100, // time_stamp
0, // modifiers
key_code,
- pp::Var());
+ pp::Var(),
+ pp::Var(code));
}
pp::InputEvent TestInputEvent::CreateCharEvent(const std::string& text) {
@@ -157,7 +160,8 @@ pp::InputEvent TestInputEvent::CreateCharEvent(const std::string& text) {
100, // time_stamp
0, // modifiers
0, // keycode
- pp::Var(text));
+ pp::Var(text),
+ pp::Var());
}
pp::InputEvent TestInputEvent::CreateTouchEvent(PP_InputEvent_Type type,
@@ -334,7 +338,7 @@ std::string TestInputEvent::TestEvents() {
SimulateInputEvent(CreateWheelEvent()));
ASSERT_TRUE(
SimulateInputEvent(CreateKeyEvent(PP_INPUTEVENT_TYPE_KEYDOWN,
- kSpaceChar)));
+ kSpaceChar, kSpaceCode)));
ASSERT_TRUE(
SimulateInputEvent(CreateCharEvent(kSpaceString)));
ASSERT_TRUE(SimulateInputEvent(CreateTouchEvent(PP_INPUTEVENT_TYPE_TOUCHSTART,
@@ -353,7 +357,7 @@ std::string TestInputEvent::TestEvents() {
SimulateInputEvent(CreateWheelEvent()));
ASSERT_FALSE(
SimulateInputEvent(CreateKeyEvent(PP_INPUTEVENT_TYPE_KEYDOWN,
- kSpaceChar)));
+ kSpaceChar, kSpaceCode)));
ASSERT_FALSE(
SimulateInputEvent(CreateCharEvent(kSpaceString)));
@@ -417,4 +421,3 @@ std::string TestInputEvent::TestAcceptTouchEvent_4() {
PP_INPUTEVENT_CLASS_TOUCH);
PASS();
}
-
diff --git a/ppapi/tests/test_input_event.h b/ppapi/tests/test_input_event.h
index 3b89368..88e7388 100644
--- a/ppapi/tests/test_input_event.h
+++ b/ppapi/tests/test_input_event.h
@@ -34,7 +34,7 @@ class TestInputEvent : public TestCase {
PP_InputEvent_MouseButton buttons);
pp::InputEvent CreateWheelEvent();
pp::InputEvent CreateKeyEvent(PP_InputEvent_Type type,
- uint32_t key_code);
+ uint32_t key_code, const std::string& code);
pp::InputEvent CreateCharEvent(const std::string& text);
pp::InputEvent CreateTouchEvent(PP_InputEvent_Type type,
const pp::FloatPoint& location);
diff --git a/ppapi/tests/test_scrollbar.cc b/ppapi/tests/test_scrollbar.cc
index 5bf3cf3..521ac17 100644
--- a/ppapi/tests/test_scrollbar.cc
+++ b/ppapi/tests/test_scrollbar.cc
@@ -43,7 +43,8 @@ std::string TestScrollbar::TestHandleEvent() {
core->GetTimeTicks(),
0, // Modifier.
0x28, // Key code = VKEY_DOWN.
- pp::Var());
+ pp::Var(),
+ pp::Var("ArrowDown"));
scrollbar_.HandleEvent(input_event);
return scrollbar_value_changed_ ?
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index a3bbc49..b0f5911 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -18,8 +18,6 @@ PROXIED_IFACE(PPB_FILECHOOSER_DEV_INTERFACE_0_5, PPB_FileChooser_Dev_0_5)
PROXIED_IFACE(PPB_FILECHOOSER_DEV_INTERFACE_0_6, PPB_FileChooser_Dev_0_6)
UNPROXIED_IFACE(PPB_FIND_DEV_INTERFACE_0_3, PPB_Find_Dev_0_3)
PROXIED_IFACE(PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_2, PPB_IMEInputEvent_Dev_0_2)
-PROXIED_IFACE(PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_2,
- PPB_KeyboardInputEvent_Dev_0_2)
PROXIED_IFACE(PPB_MEMORY_DEV_INTERFACE_0_1, PPB_Memory_Dev_0_1)
PROXIED_IFACE(PPB_PRINTING_DEV_INTERFACE_0_7, PPB_Printing_Dev_0_7)
PROXIED_IFACE(PPB_TEXTINPUT_DEV_INTERFACE_0_2, PPB_TextInput_Dev_0_2)
diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h
index ddbe913..afbf19b 100644
--- a/ppapi/thunk/interfaces_ppb_public_stable.h
+++ b/ppapi/thunk/interfaces_ppb_public_stable.h
@@ -62,6 +62,8 @@ PROXIED_IFACE(PPB_IME_INPUT_EVENT_INTERFACE_1_0, PPB_IMEInputEvent_1_0)
PROXIED_IFACE(PPB_INPUT_EVENT_INTERFACE_1_0, PPB_InputEvent_1_0)
PROXIED_IFACE(PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0,
PPB_KeyboardInputEvent_1_0)
+PROXIED_IFACE(PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_2,
+ PPB_KeyboardInputEvent_1_2)
PROXIED_IFACE(PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0, PPB_MouseInputEvent_1_0)
PROXIED_IFACE(PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1, PPB_MouseInputEvent_1_1)
PROXIED_IFACE(PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0, PPB_WheelInputEvent_1_0)
diff --git a/ppapi/thunk/ppb_input_event_api.h b/ppapi/thunk/ppb_input_event_api.h
index e2eb357..00627353 100644
--- a/ppapi/thunk/ppb_input_event_api.h
+++ b/ppapi/thunk/ppb_input_event_api.h
@@ -6,7 +6,6 @@
#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"
@@ -36,8 +35,6 @@ 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 PP_Var GetCode() = 0;
virtual uint32_t GetIMESegmentNumber() = 0;
virtual uint32_t GetIMESegmentOffset(uint32_t index) = 0;
diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc
index 5a0927d..c29b56c 100644
--- a/ppapi/thunk/ppb_input_event_thunk.cc
+++ b/ppapi/thunk/ppb_input_event_thunk.cc
@@ -244,19 +244,37 @@ const PPB_WheelInputEvent g_ppb_wheel_input_event_thunk = {
// Keyboard --------------------------------------------------------------------
-PP_Resource CreateKeyboardInputEvent(PP_Instance instance,
- PP_InputEvent_Type type,
- PP_TimeTicks time_stamp,
- uint32_t modifiers,
- uint32_t key_code,
- struct PP_Var character_text) {
+PP_Resource CreateKeyboardInputEvent_1_0(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ struct PP_Var character_text) {
VLOG(4) << "PPB_KeyboardInputEvent::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
- return enter.functions()->CreateKeyboardInputEvent(instance, type, time_stamp,
- modifiers, key_code,
- character_text);
+ return enter.functions()->CreateKeyboardInputEvent_1_0(instance, type,
+ time_stamp,
+ modifiers, key_code,
+ character_text);
+}
+
+PP_Resource CreateKeyboardInputEvent_1_2(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ struct PP_Var character_text,
+ struct PP_Var code) {
+ VLOG(4) << "PPB_KeyboardInputEvent::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateKeyboardInputEvent_1_2(instance, type,
+ time_stamp,
+ modifiers, key_code,
+ character_text, code);
}
PP_Bool IsKeyboardInputEvent(PP_Resource resource) {
@@ -286,44 +304,27 @@ PP_Var GetCharacterText(PP_Resource character_event) {
return enter.object()->GetCharacterText();
}
-const PPB_KeyboardInputEvent g_ppb_keyboard_input_event_thunk = {
- &CreateKeyboardInputEvent,
- &IsKeyboardInputEvent,
- &GetKeyCode,
- &GetCharacterText
-};
-
-// _Dev interface.
-
-PP_Bool SetUsbKeyCode(PP_Resource key_event, uint32_t usb_key_code) {
- VLOG(4) << "PPB_KeyboardInputEvent_Dev::SetUsbKeyCode()";
- 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) {
- VLOG(4) << "PPB_KeyboardInputEvent_Dev::GetUsbKeyCode()";
- EnterInputEvent enter(key_event, true);
- if (enter.failed())
- return 0;
- return enter.object()->GetUsbKeyCode();
-}
-
PP_Var GetCode(PP_Resource key_event) {
- VLOG(4) << "PPB_KeyboardInputEvent_Dev::GetCode()";
+ VLOG(4) << "PPB_KeyboardInputEvent::GetCode()";
EnterInputEvent enter(key_event, true);
if (enter.failed())
return PP_MakeUndefined();
return enter.object()->GetCode();
}
-const PPB_KeyboardInputEvent_Dev_0_2
- g_ppb_keyboard_input_event_dev_0_2_thunk = {
- &SetUsbKeyCode,
- &GetUsbKeyCode,
- &GetCode,
+const PPB_KeyboardInputEvent_1_0 g_ppb_keyboard_input_event_1_0_thunk = {
+ &CreateKeyboardInputEvent_1_0,
+ &IsKeyboardInputEvent,
+ &GetKeyCode,
+ &GetCharacterText
+};
+
+const PPB_KeyboardInputEvent g_ppb_keyboard_input_event_thunk = {
+ &CreateKeyboardInputEvent_1_2,
+ &IsKeyboardInputEvent,
+ &GetKeyCode,
+ &GetCharacterText,
+ &GetCode
};
// Composition -----------------------------------------------------------------
@@ -518,12 +519,11 @@ const PPB_MouseInputEvent_1_1* GetPPB_MouseInputEvent_1_1_Thunk() {
}
const PPB_KeyboardInputEvent_1_0* GetPPB_KeyboardInputEvent_1_0_Thunk() {
- return &g_ppb_keyboard_input_event_thunk;
+ return &g_ppb_keyboard_input_event_1_0_thunk;
}
-const PPB_KeyboardInputEvent_Dev_0_2*
- GetPPB_KeyboardInputEvent_Dev_0_2_Thunk() {
- return &g_ppb_keyboard_input_event_dev_0_2_thunk;
+const PPB_KeyboardInputEvent_1_2* GetPPB_KeyboardInputEvent_1_2_Thunk() {
+ return &g_ppb_keyboard_input_event_thunk;
}
const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() {
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index bff4f15..0c3dd42 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -63,13 +63,21 @@ class ResourceCreationAPI {
int32_t target_segment,
uint32_t selection_start,
uint32_t selection_end) = 0;
- virtual PP_Resource CreateKeyboardInputEvent(
+ virtual PP_Resource CreateKeyboardInputEvent_1_0(
PP_Instance instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
uint32_t modifiers,
uint32_t key_code,
struct PP_Var character_text) = 0;
+ virtual PP_Resource CreateKeyboardInputEvent_1_2(
+ PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ struct PP_Var character_text,
+ struct PP_Var code) = 0;
virtual PP_Resource CreateMouseInputEvent(
PP_Instance instance,
PP_InputEvent_Type type,