From f0287d39566b717d4e73b4ae8222d08d96e4a873 Mon Sep 17 00:00:00 2001 From: "garykac@chromium.org" Date: Sat, 14 Sep 2013 11:50:27 +0000 Subject: The current PPB_KeyboardInputEvent_Dev interface uses the old USB codes which were part of the original proposal. The current working-draft spec from W3C (http://www.w3.org/TR/uievents/) uses string names rather than Unicode ints. This cl updates the _Dev API to match the current spec. Note that the new APIs cannot be used until the Blink plumbing for |code| is added in a following CL. We would like to deprecate the current _Dev interface (GetUsbKeyCode) and move the new interface (GetCode) out of _Dev for M31. A note on naming: The DOM KeyboardEvent has the following attributes: * keyIdentifier (deprecated - we'll be removing this) * keyCode (deprecated, but it'll stick around for a while) * charCode (deprecated, but it'll stick around for a while) * key (specified in DOM3, not yet implemented in Chrome) * code (specified in UIEvents, adding support for this now) The current PepperAPI already has: * GetKeyCode (return the keyCode) So I used GetCode() here and I assume that we'll be adding GetKey() when we support |key|. Suggestions for better naming conventions are welcome. BUG=284774 Review URL: https://chromiumcodereview.appspot.com/23526007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223239 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/c/dev/ppb_keyboard_input_event_dev.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'ppapi/c') diff --git a/ppapi/c/dev/ppb_keyboard_input_event_dev.h b/ppapi/c/dev/ppb_keyboard_input_event_dev.h index c3c8fe2..a921bd9 100644 --- a/ppapi/c/dev/ppb_keyboard_input_event_dev.h +++ b/ppapi/c/dev/ppb_keyboard_input_event_dev.h @@ -4,7 +4,7 @@ */ /* From dev/ppb_keyboard_input_event_dev.idl, - * modified Tue Feb 21 08:56:59 2012. + * modified Fri Sep 6 10:00:04 2013. */ #ifndef PPAPI_C_DEV_PPB_KEYBOARD_INPUT_EVENT_DEV_H_ @@ -14,11 +14,12 @@ #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_1 \ - "PPB_KeyboardInputEvent(Dev);0.1" +#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_1 + PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_2 /** * @file @@ -36,7 +37,7 @@ * The PPB_KeyboardInputEvent_Dev interface is an extension to the * PPB_KeyboardInputEvent interface that provides */ -struct PPB_KeyboardInputEvent_Dev_0_1 { +struct PPB_KeyboardInputEvent_Dev_0_2 { /** * This sets a USB key code in the given PP_Resource. It is * intended that this method be called immediately after any call to @@ -63,9 +64,18 @@ struct PPB_KeyboardInputEvent_Dev_0_1 { * 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_1 PPB_KeyboardInputEvent_Dev; +typedef struct PPB_KeyboardInputEvent_Dev_0_2 PPB_KeyboardInputEvent_Dev; /** * @} */ -- cgit v1.1