diff options
author | garykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-21 22:42:58 +0000 |
---|---|---|
committer | garykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-21 22:42:58 +0000 |
commit | e1e08b4c73f6565a65e25f58374cf257ae1bbfbf (patch) | |
tree | e84f7da82738d67fc0403ea70b267db526c9e2a7 /ppapi/thunk | |
parent | 08b2596f531f40e2de46fc2121b490a9996c1105 (diff) | |
download | chromium_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
Diffstat (limited to 'ppapi/thunk')
-rw-r--r-- | ppapi/thunk/interfaces_ppb_public_dev.h | 2 | ||||
-rw-r--r-- | ppapi/thunk/ppb_input_event_api.h | 5 | ||||
-rw-r--r-- | ppapi/thunk/ppb_input_event_thunk.cc | 26 |
3 files changed, 32 insertions, 1 deletions
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; } |