Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc

Issue 9353013: Add GetUsbKeyCode dev interface for Pepper key events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More header updates to fix all presubmit problems. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h ('k') | ppapi/proxy/interface_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc
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 31d595cd8d3706b06b29e371fe5d032c1cf3518f..40d4bf9dad254bb04bf74c897212cd63b907d6ff 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
« no previous file with comments | « ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h ('k') | ppapi/proxy/interface_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698