1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 /* From dev/ppb_keyboard_input_event_dev.idl, 7 * modified Fri Sep 6 10:00:04 2013. 8 */ 9 10 #ifndef PPAPI_C_DEV_PPB_KEYBOARD_INPUT_EVENT_DEV_H_ 11 #define PPAPI_C_DEV_PPB_KEYBOARD_INPUT_EVENT_DEV_H_ 12 13 #include "ppapi/c/pp_bool.h" 14 #include "ppapi/c/pp_macros.h" 15 #include "ppapi/c/pp_resource.h" 16 #include "ppapi/c/pp_stdint.h" 17 #include "ppapi/c/pp_var.h" 18 19 #define PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_2 \ 20 "PPB_KeyboardInputEvent(Dev);0.2" 21 #define PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE \ 22 PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_2 23 24 /** 25 * @file 26 * This file defines the <code>PPB_KeyboardInputEvent_Dev</code> interface, 27 * which provides access to USB key codes that identify the physical key being 28 * pressed. 29 */ 30 31 32 /** 33 * @addtogroup Interfaces 34 * @{ 35 */ 36 /** 37 * The <code>PPB_KeyboardInputEvent_Dev</code> interface is an extension to the 38 * PPB_KeyboardInputEvent</code> interface that provides 39 */ 40 struct PPB_KeyboardInputEvent_Dev_0_2 { 41 /** 42 * This sets a USB key code in the given <code>PP_Resource</code>. It is 43 * intended that this method be called immediately after any call to 44 * <code>Create</code>. 45 * 46 * @param[in] key_event A <code>PP_Resource</code> created by 47 * <code>PPB_KeyboardInputEvent</code>'s <code>Create</code> method. 48 * 49 * @param[in] usb_key_code The USB key code to associate with this 50 * <code>key_event</code>. 51 * 52 * @return <code>PP_TRUE</code> if the USB key code was set successfully. 53 */ 54 PP_Bool (*SetUsbKeyCode)(PP_Resource key_event, uint32_t usb_key_code); 55 /** 56 * GetUsbKeyCode() returns the USB key code associated with this keyboard 57 * event. 58 * 59 * @param[in] key_event The key event for which to return the key code. 60 * 61 * @return The USB key code field for the keyboard event. If there is no 62 * USB scancode associated with this event, or if the PP_Resource does not 63 * support the PPB_InputEvent_API (i.e., it is not an input event), then 64 * a 0 is returned. 65 */ 66 uint32_t (*GetUsbKeyCode)(PP_Resource key_event); 67 /** 68 * GetCode() returns the DOM |code| field for this keyboard event, as 69 * defined by the UI Events spec: http://www.w3.org/TR/uievents/ 70 * 71 * @param[in] key_event The key event for which to return the key code. 72 * 73 * @return The string that contains the DOM |code| for the keyboard event. 74 */ 75 struct PP_Var (*GetCode)(PP_Resource key_event); 76 }; 77 78 typedef struct PPB_KeyboardInputEvent_Dev_0_2 PPB_KeyboardInputEvent_Dev; 79 /** 80 * @} 81 */ 82 83 #endif /* PPAPI_C_DEV_PPB_KEYBOARD_INPUT_EVENT_DEV_H_ */ 84 85