summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 19:33:55 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 19:33:55 +0000
commitaa0c865d8f2824f60013ace1c60b3e5fa4c2210a (patch)
treed8124920b63ea2466fb9642a19471bf0c14fe06c /ppapi
parentafa3c18d08b411bda2975a5ae6f33a4ed939875f (diff)
downloadchromium_src-aa0c865d8f2824f60013ace1c60b3e5fa4c2210a.zip
chromium_src-aa0c865d8f2824f60013ace1c60b3e5fa4c2210a.tar.gz
chromium_src-aa0c865d8f2824f60013ace1c60b3e5fa4c2210a.tar.bz2
Allow creation of input events. Revert changes to testing interface for
creating keyboard events. TEST=manual Review URL: http://codereview.chromium.org/7443005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/ppb_core.idl4
-rw-r--r--ppapi/c/dev/ppb_testing_dev.h13
-rw-r--r--ppapi/c/ppb_input_event.h40
-rw-r--r--ppapi/cpp/input_event.cc43
-rw-r--r--ppapi/cpp/input_event.h28
-rw-r--r--ppapi/proxy/ppb_testing_proxy.cc21
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc72
-rw-r--r--ppapi/proxy/resource_creation_proxy.h22
-rw-r--r--ppapi/tests/test_scrollbar.cc9
-rw-r--r--ppapi/thunk/ppb_input_event_thunk.cc46
-rw-r--r--ppapi/thunk/resource_creation_api.h23
11 files changed, 280 insertions, 41 deletions
diff --git a/ppapi/api/ppb_core.idl b/ppapi/api/ppb_core.idl
index d7601cf..f7ef951 100644
--- a/ppapi/api/ppb_core.idl
+++ b/ppapi/api/ppb_core.idl
@@ -54,10 +54,6 @@ interface PPB_Core {
* @return A <code>PP_TimeTicks</code> containing the "tick time" according
* to the browser.
*/
-
-// TODO(brettw) http://code.google.com/p/chromium/issues/detail?id=57448
-// This currently does change with wall clock time, but will be fixed in
-// a future release.
PP_TimeTicks GetTimeTicks();
/**
diff --git a/ppapi/c/dev/ppb_testing_dev.h b/ppapi/c/dev/ppb_testing_dev.h
index 26daa78..ec70102 100644
--- a/ppapi/c/dev/ppb_testing_dev.h
+++ b/ppapi/c/dev/ppb_testing_dev.h
@@ -9,12 +9,11 @@
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
-#include "ppapi/c/ppb_input_event.h"
struct PP_Point;
-#define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7"
-#define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_7
+#define PPB_TESTING_DEV_INTERFACE_0_6 "PPB_Testing(Dev);0.6"
+#define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_6
// This interface contains functions used for unit testing. Do not use in
// production code. They are not guaranteed to be available in normal plugin
@@ -69,14 +68,6 @@ struct PPB_Testing_Dev {
// associated with this plugin instance. Used for detecting leaks. Returns
// (uint32_t)-1 on failure.
uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
-
- // Creates a keyboard input event resource with the given parameters.
- PP_Resource (*CreateKeyboardInputEvent)(PP_Instance instance,
- PP_InputEvent_Type type,
- PP_TimeTicks ticks,
- uint32_t modifiers,
- uint32_t key_code,
- struct PP_Var char_text);
};
#endif /* PPAPI_C_DEV_PPB_TESTING_DEV_H_ */
diff --git a/ppapi/c/ppb_input_event.h b/ppapi/c/ppb_input_event.h
index c208a3e..b3c62a7 100644
--- a/ppapi/c/ppb_input_event.h
+++ b/ppapi/c/ppb_input_event.h
@@ -348,6 +348,20 @@ struct PPB_InputEvent {
struct PPB_MouseInputEvent {
/**
+ * Creates a mouse input event with the given parameters. Normally you will
+ * get a mouse 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 mouse event types.
+ */
+ PP_Resource (*Create)(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_InputEvent_MouseButton mouse_button,
+ struct PP_Point mouse_position,
+ int32_t click_count);
+
+ /**
* Determines if a resource is a mouse event.
*
* @return PP_TRUE if the given resource is a valid mouse input event.
@@ -380,6 +394,19 @@ struct PPB_MouseInputEvent {
struct PPB_WheelInputEvent {
/**
+ * Creates a wheel input event with the given parameters. Normally you will
+ * get a wheel event passed through the HandleInputEvent and will not need
+ * to create them, but some applications may want to create their own for
+ * internal use.
+ */
+ PP_Resource (*Create)(PP_Instance instance,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ struct PP_FloatPoint wheel_delta,
+ struct PP_FloatPoint wheel_ticks,
+ PP_Bool scroll_by_page);
+
+ /**
* Determines if a resource is a wheel event.
*
* @return PP_TRUE if the given resource is a valid wheel input event.
@@ -442,6 +469,19 @@ struct PPB_WheelInputEvent {
struct PPB_KeyboardInputEvent {
/**
+ * 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.
+ */
+ 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);
+
+ /**
* Determines if a resource is a keyboard event.
*
* @return PP_TRUE if the given resource is a valid mouse input event.
diff --git a/ppapi/cpp/input_event.cc b/ppapi/cpp/input_event.cc
index bcea1c3..d983603 100644
--- a/ppapi/cpp/input_event.cc
+++ b/ppapi/cpp/input_event.cc
@@ -84,6 +84,21 @@ MouseInputEvent::MouseInputEvent(const InputEvent& event) : InputEvent() {
}
}
+MouseInputEvent::MouseInputEvent(Instance* instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_InputEvent_MouseButton mouse_button,
+ const Point& mouse_position,
+ int32_t click_count) {
+ // Type check the input event before setting it.
+ if (!has_interface<PPB_MouseInputEvent>())
+ return;
+ PassRefFromConstructor(get_interface<PPB_MouseInputEvent>()->Create(
+ instance->pp_instance(), type, time_stamp, modifiers, mouse_button,
+ mouse_position, click_count));
+}
+
PP_InputEvent_MouseButton MouseInputEvent::GetMouseButton() const {
if (!has_interface<PPB_MouseInputEvent>())
return PP_INPUTEVENT_MOUSEBUTTON_NONE;
@@ -119,6 +134,20 @@ WheelInputEvent::WheelInputEvent(const InputEvent& event) : InputEvent() {
}
}
+WheelInputEvent::WheelInputEvent(Instance* instance,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ const FloatPoint& wheel_delta,
+ const FloatPoint& wheel_ticks,
+ bool scroll_by_page) {
+ // Type check the input event before setting it.
+ if (!has_interface<PPB_WheelInputEvent>())
+ return;
+ PassRefFromConstructor(get_interface<PPB_WheelInputEvent>()->Create(
+ instance->pp_instance(), time_stamp, modifiers, wheel_delta,
+ wheel_ticks, PP_FromBool(scroll_by_page)));
+}
+
FloatPoint WheelInputEvent::GetWheelDelta() const {
if (!has_interface<PPB_WheelInputEvent>())
return FloatPoint();
@@ -154,6 +183,20 @@ KeyboardInputEvent::KeyboardInputEvent(const InputEvent& event) : InputEvent() {
}
}
+KeyboardInputEvent::KeyboardInputEvent(Instance* instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ const Var& character_text) {
+ // Type check the input event before setting it.
+ if (!has_interface<PPB_KeyboardInputEvent>())
+ return;
+ PassRefFromConstructor(get_interface<PPB_KeyboardInputEvent>()->Create(
+ instance->pp_instance(), type, time_stamp, modifiers, key_code,
+ character_text.pp_var()));
+}
+
uint32_t KeyboardInputEvent::GetKeyCode() const {
if (!has_interface<PPB_KeyboardInputEvent>())
return 0;
diff --git a/ppapi/cpp/input_event.h b/ppapi/cpp/input_event.h
index 0d8eecc..40e4aa0 100644
--- a/ppapi/cpp/input_event.h
+++ b/ppapi/cpp/input_event.h
@@ -5,12 +5,15 @@
#ifndef PPAPI_CPP_INPUT_EVENT_H_
#define PPAPI_CPP_INPUT_EVENT_H_
+#include <string>
+
#include "ppapi/c/ppb_input_event.h"
#include "ppapi/cpp/resource.h"
namespace pp {
class FloatPoint;
+class Instance;
class Point;
class Var;
@@ -77,6 +80,15 @@ class MouseInputEvent : public InputEvent {
/// event, the mouse object will be is_null().
explicit MouseInputEvent(const InputEvent& event);
+ /// Manually constructs a mouse event from the given parameters.
+ MouseInputEvent(Instance* instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_InputEvent_MouseButton mouse_button,
+ const Point& mouse_position,
+ int32_t click_count);
+
/// Returns the mouse position for a mouse input event.
///
/// @return The mouse button associated with mouse down and up events. This
@@ -106,6 +118,14 @@ class WheelInputEvent : public InputEvent {
/// event, the wheel object will be is_null().
explicit WheelInputEvent(const InputEvent& event);
+ /// Constructs a wheel input even from the given parameters.
+ WheelInputEvent(Instance* instance,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ const FloatPoint& wheel_delta,
+ const FloatPoint& wheel_ticks,
+ bool scroll_by_page);
+
/// Indicates the amount vertically and horizontally the user has requested
/// to scroll by with their mouse wheel. A scroll down or to the right (where
/// the content moves up or left) is represented as positive values, and
@@ -163,6 +183,14 @@ class KeyboardInputEvent : public InputEvent {
/// event, the keybaord object will be is_null().
explicit KeyboardInputEvent(const InputEvent& event);
+ /// Constructs a keyboard input even from the given parameters.
+ KeyboardInputEvent(Instance* instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ const Var& character_text);
+
/// 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;
diff --git a/ppapi/proxy/ppb_testing_proxy.cc b/ppapi/proxy/ppb_testing_proxy.cc
index 628fa7b..593ed7d 100644
--- a/ppapi/proxy/ppb_testing_proxy.cc
+++ b/ppapi/proxy/ppb_testing_proxy.cc
@@ -9,9 +9,7 @@
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
-#include "ppapi/proxy/plugin_var_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_input_event_proxy.h"
namespace pp {
namespace proxy {
@@ -72,25 +70,6 @@ uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
return result;
}
-PP_Resource CreateKeyboardInputEvent(PP_Instance instance,
- PP_InputEvent_Type type,
- PP_TimeTicks ticks,
- uint32_t modifiers,
- uint32_t key_code,
- PP_Var char_text) {
- PluginVarTracker* tracker = PluginVarTracker::GetInstance();
-
- ppapi::InputEventData data;
- data.event_type = type;
- data.event_time_stamp = ticks;
- data.event_modifiers = modifiers;
- data.key_code = key_code;
- if (char_text.type == PP_VARTYPE_STRING)
- data.character_text = *tracker->GetExistingString(char_text);
-
- return PPB_InputEvent_Proxy::CreateProxyResource(instance, data);
-}
-
const PPB_Testing_Dev testing_interface = {
&ReadImageData,
&RunMessageLoop,
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index c498002..8ebdb29 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -27,14 +27,17 @@
#include "ppapi/proxy/ppb_graphics_2d_proxy.h"
#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
#include "ppapi/proxy/ppb_image_data_proxy.h"
+#include "ppapi/proxy/ppb_input_event_proxy.h"
#include "ppapi/proxy/ppb_surface_3d_proxy.h"
#include "ppapi/proxy/ppb_url_loader_proxy.h"
#include "ppapi/proxy/ppb_url_request_info_proxy.h"
#include "ppapi/shared_impl/font_impl.h"
#include "ppapi/shared_impl/function_group_base.h"
+#include "ppapi/shared_impl/input_event_impl.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_image_data_api.h"
+using ppapi::InputEventData;
using ppapi::thunk::ResourceCreationAPI;
namespace pp {
@@ -189,6 +192,57 @@ PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance,
return PluginResourceTracker::GetInstance()->AddResource(object);
}
+PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent(
+ PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ struct PP_Var character_text) {
+ if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN &&
+ type != PP_INPUTEVENT_TYPE_KEYDOWN &&
+ type != PP_INPUTEVENT_TYPE_KEYUP &&
+ type != PP_INPUTEVENT_TYPE_CHAR)
+ return 0;
+ PluginVarTracker* tracker = PluginVarTracker::GetInstance();
+
+ ppapi::InputEventData data;
+ data.event_type = type;
+ data.event_time_stamp = time_stamp;
+ data.event_modifiers = modifiers;
+ data.key_code = key_code;
+ if (character_text.type == PP_VARTYPE_STRING)
+ data.character_text = *tracker->GetExistingString(character_text);
+
+ return PPB_InputEvent_Proxy::CreateProxyResource(instance, data);
+}
+
+PP_Resource ResourceCreationProxy::CreateMouseInputEvent(
+ PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_InputEvent_MouseButton mouse_button,
+ PP_Point mouse_position,
+ int32_t click_count) {
+ if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN &&
+ type != PP_INPUTEVENT_TYPE_MOUSEUP &&
+ type != PP_INPUTEVENT_TYPE_MOUSEMOVE &&
+ type != PP_INPUTEVENT_TYPE_MOUSEENTER &&
+ type != PP_INPUTEVENT_TYPE_MOUSELEAVE)
+ return 0;
+
+ ppapi::InputEventData data;
+ data.event_type = type;
+ data.event_time_stamp = time_stamp;
+ data.event_modifiers = modifiers;
+ data.mouse_button = mouse_button;
+ data.mouse_position = mouse_position;
+ data.mouse_click_count = click_count;
+
+ return PPB_InputEvent_Proxy::CreateProxyResource(instance, data);
+}
+
PP_Resource ResourceCreationProxy::CreateGraphics3D(
PP_Instance instance,
PP_Config3D_Dev config,
@@ -249,6 +303,24 @@ PP_Resource ResourceCreationProxy::CreateVideoLayer(
return 0;
}
+PP_Resource ResourceCreationProxy::CreateWheelInputEvent(
+ PP_Instance instance,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_FloatPoint wheel_delta,
+ PP_FloatPoint wheel_ticks,
+ PP_Bool scroll_by_page) {
+ ppapi::InputEventData data;
+ data.event_type = PP_INPUTEVENT_TYPE_MOUSEWHEEL;
+ data.event_time_stamp = time_stamp;
+ data.event_modifiers = modifiers;
+ data.wheel_delta = wheel_delta;
+ data.wheel_ticks = wheel_ticks;
+ data.wheel_scroll_by_page = PP_ToBool(scroll_by_page);
+
+ return PPB_InputEvent_Proxy::CreateProxyResource(instance, data);
+}
+
bool ResourceCreationProxy::Send(IPC::Message* msg) {
return dispatcher_->Send(msg);
}
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index 4336f85..18c6eff 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -84,6 +84,21 @@ class ResourceCreationProxy : public ::ppapi::FunctionGroupBase,
PP_ImageDataFormat format,
const PP_Size& size,
PP_Bool init_to_zero) OVERRIDE;
+ virtual 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) OVERRIDE;
+ virtual PP_Resource CreateMouseInputEvent(
+ PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_InputEvent_MouseButton mouse_button,
+ PP_Point mouse_position,
+ int32_t click_count) OVERRIDE;
virtual PP_Resource CreateScrollbar(PP_Instance instance,
PP_Bool vertical) OVERRIDE;
virtual PP_Resource CreateSurface3D(PP_Instance instance,
@@ -97,6 +112,13 @@ class ResourceCreationProxy : public ::ppapi::FunctionGroupBase,
virtual PP_Resource CreateVideoDecoder(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateVideoLayer(PP_Instance instance,
PP_VideoLayerMode_Dev mode) OVERRIDE;
+ virtual PP_Resource CreateWheelInputEvent(
+ PP_Instance instance,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_FloatPoint wheel_delta,
+ PP_FloatPoint wheel_ticks,
+ PP_Bool scroll_by_page) OVERRIDE;
virtual bool Send(IPC::Message* msg) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
diff --git a/ppapi/tests/test_scrollbar.cc b/ppapi/tests/test_scrollbar.cc
index 967d8d2..2aa658a 100644
--- a/ppapi/tests/test_scrollbar.cc
+++ b/ppapi/tests/test_scrollbar.cc
@@ -39,14 +39,13 @@ std::string TestScrollbar::TestHandleEvent() {
scrollbar_.SetDocumentSize(10000);
pp::Core* core = pp::Module::Get()->core();
- PP_Resource input_event = testing_interface_->CreateKeyboardInputEvent(
- instance_->pp_instance(), PP_INPUTEVENT_TYPE_KEYDOWN,
+ pp::KeyboardInputEvent input_event(
+ instance_, PP_INPUTEVENT_TYPE_KEYDOWN,
core->GetTimeTicks(),
0, // Modifier.
0x28, // Key code = VKEY_DOWN.
- PP_MakeUndefined());
- scrollbar_.HandleEvent(pp::InputEvent(input_event));
- core->ReleaseResource(input_event);
+ pp::Var());
+ scrollbar_.HandleEvent(input_event);
return scrollbar_value_changed_ ?
"" : "Didn't get callback for scrollbar value change";
diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc
index 501502c..4fee1a1 100644
--- a/ppapi/thunk/ppb_input_event_thunk.cc
+++ b/ppapi/thunk/ppb_input_event_thunk.cc
@@ -80,6 +80,21 @@ const PPB_InputEvent g_ppb_input_event_thunk = {
// Mouse -----------------------------------------------------------------------
+PP_Resource CreateMouseInputEvent(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_InputEvent_MouseButton mouse_button,
+ PP_Point mouse_position,
+ int32_t click_count) {
+ EnterFunction<ResourceCreationAPI> enter(instance, true);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateMouseInputEvent(instance, type, time_stamp,
+ modifiers, mouse_button,
+ mouse_position, click_count);
+}
+
PP_Bool IsMouseInputEvent(PP_Resource resource) {
if (!IsInputEvent(resource))
return PP_FALSE; // Prevent warning log in GetType.
@@ -114,6 +129,7 @@ int32_t GetMouseClickCount(PP_Resource mouse_event) {
}
const PPB_MouseInputEvent g_ppb_mouse_input_event_thunk = {
+ &CreateMouseInputEvent,
&IsMouseInputEvent,
&GetMouseButton,
&GetMousePosition,
@@ -122,6 +138,20 @@ const PPB_MouseInputEvent g_ppb_mouse_input_event_thunk = {
// Wheel -----------------------------------------------------------------------
+PP_Resource CreateWheelInputEvent(PP_Instance instance,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_FloatPoint wheel_delta,
+ PP_FloatPoint wheel_ticks,
+ PP_Bool scroll_by_page) {
+ EnterFunction<ResourceCreationAPI> enter(instance, true);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateWheelInputEvent(instance, time_stamp,
+ modifiers, wheel_delta,
+ wheel_ticks, scroll_by_page);
+}
+
PP_Bool IsWheelInputEvent(PP_Resource resource) {
if (!IsInputEvent(resource))
return PP_FALSE; // Prevent warning log in GetType.
@@ -151,6 +181,7 @@ PP_Bool GetWheelScrollByPage(PP_Resource wheel_event) {
}
const PPB_WheelInputEvent g_ppb_wheel_input_event_thunk = {
+ &CreateWheelInputEvent,
&IsWheelInputEvent,
&GetWheelDelta,
&GetWheelTicks,
@@ -159,6 +190,20 @@ 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) {
+ EnterFunction<ResourceCreationAPI> enter(instance, true);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateKeyboardInputEvent(instance, type, time_stamp,
+ modifiers, key_code,
+ character_text);
+}
+
PP_Bool IsKeyboardInputEvent(PP_Resource resource) {
if (!IsInputEvent(resource))
return PP_FALSE; // Prevent warning log in GetType.
@@ -183,6 +228,7 @@ PP_Var GetCharacterText(PP_Resource character_event) {
}
const PPB_KeyboardInputEvent g_ppb_keyboard_input_event_thunk = {
+ &CreateKeyboardInputEvent,
&IsKeyboardInputEvent,
&GetKeyCode,
&GetCharacterText
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index 15641c3..3ac84b2 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -15,6 +15,7 @@
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/ppb_file_system.h"
#include "ppapi/c/ppb_image_data.h"
+#include "ppapi/c/ppb_input_event.h"
#include "ppapi/proxy/interface_id.h"
struct PP_Flash_Menu;
@@ -83,6 +84,21 @@ class ResourceCreationAPI {
PP_ImageDataFormat format,
const PP_Size& size,
PP_Bool init_to_zero) = 0;
+ virtual 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) = 0;
+ virtual PP_Resource CreateMouseInputEvent(
+ PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_InputEvent_MouseButton mouse_button,
+ PP_Point mouse_position,
+ int32_t click_count) = 0;
virtual PP_Resource CreateScrollbar(PP_Instance instance,
PP_Bool vertical) = 0;
virtual PP_Resource CreateSurface3D(PP_Instance instance,
@@ -96,6 +112,13 @@ class ResourceCreationAPI {
virtual PP_Resource CreateVideoDecoder(PP_Instance instance) = 0;
virtual PP_Resource CreateVideoLayer(PP_Instance instance,
PP_VideoLayerMode_Dev mode) = 0;
+ virtual PP_Resource CreateWheelInputEvent(
+ PP_Instance instance,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_FloatPoint wheel_delta,
+ PP_FloatPoint wheel_ticks,
+ PP_Bool scroll_by_page) = 0;
static const ::pp::proxy::InterfaceID interface_id =
::pp::proxy::INTERFACE_ID_RESOURCE_CREATION;