summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 17:08:59 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 17:08:59 +0000
commitcbe3e07b561b8c6a5f31fa94e566aae4bce67305 (patch)
treed651427665883b80a6ebf30a5f7e7bca3a4bc0e6
parentc88cbfa32dfc9847277a753ffc464d806fa0a4ee (diff)
downloadchromium_src-cbe3e07b561b8c6a5f31fa94e566aae4bce67305.zip
chromium_src-cbe3e07b561b8c6a5f31fa94e566aae4bce67305.tar.gz
chromium_src-cbe3e07b561b8c6a5f31fa94e566aae4bce67305.tar.bz2
Update the widget API to use the new InputEvent resource rather than the old
PP_InputEvent struct. TEST=manual BUG=none Review URL: http://codereview.chromium.org/7399035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93044 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ppapi/c/dev/ppb_testing_dev.h13
-rw-r--r--ppapi/c/dev/ppb_widget_dev.h8
-rw-r--r--ppapi/cpp/dev/widget_dev.cc5
-rw-r--r--ppapi/cpp/dev/widget_dev.h5
-rw-r--r--ppapi/proxy/ppb_testing_proxy.cc21
-rw-r--r--ppapi/tests/test_scrollbar.cc21
-rw-r--r--ppapi/tests/test_scrollbar.h1
-rw-r--r--ppapi/thunk/ppb_widget_api.h2
-rw-r--r--ppapi/thunk/ppb_widget_thunk.cc4
-rw-r--r--webkit/plugins/ppapi/event_conversion.cc58
-rw-r--r--webkit/plugins/ppapi/event_conversion.h1
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc29
-rw-r--r--webkit/plugins/ppapi/ppb_scrollbar_impl.cc17
-rw-r--r--webkit/plugins/ppapi/ppb_scrollbar_impl.h5
-rw-r--r--webkit/plugins/ppapi/ppb_widget_impl.cc10
-rw-r--r--webkit/plugins/ppapi/ppb_widget_impl.h7
16 files changed, 141 insertions, 66 deletions
diff --git a/ppapi/c/dev/ppb_testing_dev.h b/ppapi/c/dev/ppb_testing_dev.h
index ec70102..26daa78 100644
--- a/ppapi/c/dev/ppb_testing_dev.h
+++ b/ppapi/c/dev/ppb_testing_dev.h
@@ -9,11 +9,12 @@
#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_6 "PPB_Testing(Dev);0.6"
-#define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_6
+#define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7"
+#define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_7
// This interface contains functions used for unit testing. Do not use in
// production code. They are not guaranteed to be available in normal plugin
@@ -68,6 +69,14 @@ 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/dev/ppb_widget_dev.h b/ppapi/c/dev/ppb_widget_dev.h
index a0effb5..0b04f79 100644
--- a/ppapi/c/dev/ppb_widget_dev.h
+++ b/ppapi/c/dev/ppb_widget_dev.h
@@ -9,10 +9,9 @@
#include "ppapi/c/pp_resource.h"
struct PP_Rect;
-struct PP_InputEvent;
-#define PPB_WIDGET_DEV_INTERFACE_0_2 "PPB_Widget(Dev);0.2"
-#define PPB_WIDGET_DEV_INTERFACE PPB_WIDGET_DEV_INTERFACE_0_2
+#define PPB_WIDGET_DEV_INTERFACE_0_3 "PPB_Widget(Dev);0.3"
+#define PPB_WIDGET_DEV_INTERFACE PPB_WIDGET_DEV_INTERFACE_0_3
// The interface for reusing browser widgets.
struct PPB_Widget_Dev {
@@ -28,8 +27,7 @@ struct PPB_Widget_Dev {
// Pass in an event to a widget. It'll return PP_TRUE if the event was
// consumed.
- PP_Bool (*HandleEvent)(PP_Resource widget,
- const struct PP_InputEvent* event);
+ PP_Bool (*HandleEvent)(PP_Resource widget, PP_Resource input_event);
// Get/set the location of the widget.
PP_Bool (*GetLocation)(PP_Resource widget,
diff --git a/ppapi/cpp/dev/widget_dev.cc b/ppapi/cpp/dev/widget_dev.cc
index ae28969..97d941f 100644
--- a/ppapi/cpp/dev/widget_dev.cc
+++ b/ppapi/cpp/dev/widget_dev.cc
@@ -6,6 +6,7 @@
#include "ppapi/c/dev/ppb_widget_dev.h"
#include "ppapi/cpp/image_data.h"
+#include "ppapi/cpp/input_event.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/rect.h"
@@ -34,11 +35,11 @@ bool Widget_Dev::Paint(const Rect& rect, ImageData* image) {
pp_resource(), &rect.pp_rect(), image->pp_resource()));
}
-bool Widget_Dev::HandleEvent(const PP_InputEvent& event) {
+bool Widget_Dev::HandleEvent(const InputEvent& event) {
if (!has_interface<PPB_Widget_Dev>())
return false;
return PP_ToBool(get_interface<PPB_Widget_Dev>()->HandleEvent(
- pp_resource(), &event));
+ pp_resource(), event.pp_resource()));
}
bool Widget_Dev::GetLocation(Rect* location) {
diff --git a/ppapi/cpp/dev/widget_dev.h b/ppapi/cpp/dev/widget_dev.h
index bdc1399..79540a8 100644
--- a/ppapi/cpp/dev/widget_dev.h
+++ b/ppapi/cpp/dev/widget_dev.h
@@ -8,11 +8,10 @@
#include "ppapi/c/pp_stdint.h"
#include "ppapi/cpp/resource.h"
-struct PP_InputEvent;
-
namespace pp {
class ImageData;
+class InputEvent;
class Instance;
class Rect;
@@ -28,7 +27,7 @@ class Widget_Dev : public Resource {
// PPB_Widget methods:
bool Paint(const Rect& rect, ImageData* image);
- bool HandleEvent(const PP_InputEvent& event);
+ bool HandleEvent(const InputEvent& event);
bool GetLocation(Rect* location);
void SetLocation(const Rect& location);
};
diff --git a/ppapi/proxy/ppb_testing_proxy.cc b/ppapi/proxy/ppb_testing_proxy.cc
index 593ed7d..628fa7b 100644
--- a/ppapi/proxy/ppb_testing_proxy.cc
+++ b/ppapi/proxy/ppb_testing_proxy.cc
@@ -9,7 +9,9 @@
#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 {
@@ -70,6 +72,25 @@ 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/tests/test_scrollbar.cc b/ppapi/tests/test_scrollbar.cc
index 973c51b..967d8d2 100644
--- a/ppapi/tests/test_scrollbar.cc
+++ b/ppapi/tests/test_scrollbar.cc
@@ -6,7 +6,9 @@
#include <cstring>
+#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/pp_input_event.h"
+#include "ppapi/cpp/input_event.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/tests/testing_instance.h"
@@ -20,6 +22,10 @@ TestScrollbar::TestScrollbar(TestingInstance* instance)
scrollbar_value_changed_(false) {
}
+bool TestScrollbar::Init() {
+ return InitTestingInterface();
+}
+
void TestScrollbar::RunTest() {
instance_->LogTest("HandleEvent", TestHandleEvent());
}
@@ -32,12 +38,15 @@ std::string TestScrollbar::TestHandleEvent() {
scrollbar_.SetDocumentSize(10000);
- PP_InputEvent event;
- std::memset(&event, 0, sizeof(event));
- event.type = PP_INPUTEVENT_TYPE_KEYDOWN;
- event.u.key.modifier = 0;
- event.u.key.key_code = 0x28; // VKEY_DOWN
- scrollbar_.HandleEvent(event);
+ pp::Core* core = pp::Module::Get()->core();
+ PP_Resource input_event = testing_interface_->CreateKeyboardInputEvent(
+ instance_->pp_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);
return scrollbar_value_changed_ ?
"" : "Didn't get callback for scrollbar value change";
diff --git a/ppapi/tests/test_scrollbar.h b/ppapi/tests/test_scrollbar.h
index 9a9bb1d..5211f97 100644
--- a/ppapi/tests/test_scrollbar.h
+++ b/ppapi/tests/test_scrollbar.h
@@ -16,6 +16,7 @@ class TestScrollbar : public TestCase,
TestScrollbar(TestingInstance* instance);
// TestCase implementation.
+ virtual bool Init();
virtual void RunTest();
private:
diff --git a/ppapi/thunk/ppb_widget_api.h b/ppapi/thunk/ppb_widget_api.h
index d5d367c..1a03d62 100644
--- a/ppapi/thunk/ppb_widget_api.h
+++ b/ppapi/thunk/ppb_widget_api.h
@@ -15,7 +15,7 @@ class PPB_Widget_API {
virtual ~PPB_Widget_API() {}
virtual PP_Bool Paint(const PP_Rect* rect, PP_Resource image_id) = 0;
- virtual PP_Bool HandleEvent(const PP_InputEvent* event) = 0;
+ virtual PP_Bool HandleEvent(PP_Resource pp_input_event) = 0;
virtual PP_Bool GetLocation(PP_Rect* location) = 0;
virtual void SetLocation(const PP_Rect* location) = 0;
};
diff --git a/ppapi/thunk/ppb_widget_thunk.cc b/ppapi/thunk/ppb_widget_thunk.cc
index 7834a7a..374296b 100644
--- a/ppapi/thunk/ppb_widget_thunk.cc
+++ b/ppapi/thunk/ppb_widget_thunk.cc
@@ -24,11 +24,11 @@ PP_Bool Paint(PP_Resource widget, const PP_Rect* rect, PP_Resource image_id) {
return enter.object()->Paint(rect, image_id);
}
-PP_Bool HandleEvent(PP_Resource widget, const PP_InputEvent* event) {
+PP_Bool HandleEvent(PP_Resource widget, PP_Resource pp_input_event) {
EnterResource<PPB_Widget_API> enter(widget, false);
if (enter.failed())
return PP_FALSE;
- return enter.object()->HandleEvent(event);
+ return enter.object()->HandleEvent(pp_input_event);
}
PP_Bool GetLocation(PP_Resource widget, PP_Rect* location) {
diff --git a/webkit/plugins/ppapi/event_conversion.cc b/webkit/plugins/ppapi/event_conversion.cc
index 6632f5b..41db456c 100644
--- a/webkit/plugins/ppapi/event_conversion.cc
+++ b/webkit/plugins/ppapi/event_conversion.cc
@@ -152,9 +152,9 @@ void AppendMouseWheelEvent(const WebInputEvent& event,
result_events->push_back(result);
}
-WebKeyboardEvent* BuildKeyEvent(const PP_InputEvent& event) {
+WebKeyboardEvent* BuildKeyEvent(const InputEventData& event) {
WebKeyboardEvent* key_event = new WebKeyboardEvent();
- switch (event.type) {
+ switch (event.event_type) {
case PP_INPUTEVENT_TYPE_RAWKEYDOWN:
key_event->type = WebInputEvent::RawKeyDown;
break;
@@ -167,25 +167,22 @@ WebKeyboardEvent* BuildKeyEvent(const PP_InputEvent& event) {
default:
NOTREACHED();
}
- key_event->timeStampSeconds = PPTimeTicksToEventTime(event.time_stamp);
- key_event->modifiers = event.u.key.modifier;
- key_event->windowsKeyCode = event.u.key.key_code;
+ key_event->timeStampSeconds = PPTimeTicksToEventTime(event.event_time_stamp);
+ key_event->modifiers = event.event_modifiers;
+ key_event->windowsKeyCode = event.key_code;
return key_event;
}
-WebKeyboardEvent* BuildCharEvent(const PP_InputEvent& event) {
+WebKeyboardEvent* BuildCharEvent(const InputEventData& event) {
WebKeyboardEvent* key_event = new WebKeyboardEvent();
key_event->type = WebInputEvent::Char;
- key_event->timeStampSeconds = PPTimeTicksToEventTime(event.time_stamp);
- key_event->modifiers = event.u.character.modifier;
+ key_event->timeStampSeconds = PPTimeTicksToEventTime(event.event_time_stamp);
+ key_event->modifiers = event.event_modifiers;
// Make sure to not read beyond the buffer in case some bad code doesn't
// NULL-terminate it (this is called from plugins).
size_t text_length_cap = WebKeyboardEvent::textLengthCap;
- size_t text_len = 0;
- while (text_len < text_length_cap && event.u.character.text[text_len])
- text_len++;
- string16 text16 = UTF8ToUTF16(std::string(event.u.character.text, text_len));
+ string16 text16 = UTF8ToUTF16(event.character_text);
memset(key_event->text, 0, text_length_cap);
memset(key_event->unmodifiedText, 0, text_length_cap);
@@ -196,9 +193,9 @@ WebKeyboardEvent* BuildCharEvent(const PP_InputEvent& event) {
return key_event;
}
-WebMouseEvent* BuildMouseEvent(const PP_InputEvent& event) {
+WebMouseEvent* BuildMouseEvent(const InputEventData& event) {
WebMouseEvent* mouse_event = new WebMouseEvent();
- switch (event.type) {
+ switch (event.event_type) {
case PP_INPUTEVENT_TYPE_MOUSEDOWN:
mouse_event->type = WebInputEvent::MouseDown;
break;
@@ -220,27 +217,28 @@ WebMouseEvent* BuildMouseEvent(const PP_InputEvent& event) {
default:
NOTREACHED();
}
- mouse_event->timeStampSeconds = PPTimeTicksToEventTime(event.time_stamp);
- mouse_event->modifiers = event.u.mouse.modifier;
+ mouse_event->timeStampSeconds =
+ PPTimeTicksToEventTime(event.event_time_stamp);
+ mouse_event->modifiers = event.event_modifiers;
mouse_event->button =
- static_cast<WebMouseEvent::Button>(event.u.mouse.button);
- mouse_event->x = static_cast<int>(event.u.mouse.x);
- mouse_event->y = static_cast<int>(event.u.mouse.y);
- mouse_event->clickCount = event.u.mouse.click_count;
+ static_cast<WebMouseEvent::Button>(event.mouse_button);
+ mouse_event->x = event.mouse_position.x;
+ mouse_event->y = event.mouse_position.y;
+ mouse_event->clickCount = event.mouse_click_count;
return mouse_event;
}
-WebMouseWheelEvent* BuildMouseWheelEvent(const PP_InputEvent& event) {
+WebMouseWheelEvent* BuildMouseWheelEvent(const InputEventData& event) {
WebMouseWheelEvent* mouse_wheel_event = new WebMouseWheelEvent();
mouse_wheel_event->type = WebInputEvent::MouseWheel;
mouse_wheel_event->timeStampSeconds =
- PPTimeTicksToEventTime(event.time_stamp);
- mouse_wheel_event->modifiers = event.u.wheel.modifier;
- mouse_wheel_event->deltaX = event.u.wheel.delta_x;
- mouse_wheel_event->deltaY = event.u.wheel.delta_y;
- mouse_wheel_event->wheelTicksX = event.u.wheel.wheel_ticks_x;
- mouse_wheel_event->wheelTicksY = event.u.wheel.wheel_ticks_y;
- mouse_wheel_event->scrollByPage = event.u.wheel.scroll_by_page;
+ PPTimeTicksToEventTime(event.event_time_stamp);
+ mouse_wheel_event->modifiers = event.event_modifiers;
+ mouse_wheel_event->deltaX = event.wheel_delta.x;
+ mouse_wheel_event->deltaY = event.wheel_delta.y;
+ mouse_wheel_event->wheelTicksX = event.wheel_ticks.x;
+ mouse_wheel_event->wheelTicksY = event.wheel_ticks.y;
+ mouse_wheel_event->scrollByPage = event.wheel_scroll_by_page;
return mouse_wheel_event;
}
@@ -328,9 +326,9 @@ void CreateInputEventData(const WebInputEvent& event,
}
}
-WebInputEvent* CreateWebInputEvent(const PP_InputEvent& event) {
+WebInputEvent* CreateWebInputEvent(const InputEventData& event) {
scoped_ptr<WebInputEvent> web_input_event;
- switch (event.type) {
+ switch (event.event_type) {
case PP_INPUTEVENT_TYPE_UNDEFINED:
return NULL;
case PP_INPUTEVENT_TYPE_MOUSEDOWN:
diff --git a/webkit/plugins/ppapi/event_conversion.h b/webkit/plugins/ppapi/event_conversion.h
index 07cabf8..99e9097 100644
--- a/webkit/plugins/ppapi/event_conversion.h
+++ b/webkit/plugins/ppapi/event_conversion.h
@@ -34,7 +34,6 @@ void CreateInputEventData(const WebKit::WebInputEvent& event,
// Creates a WebInputEvent from the given PP_InputEvent. If it fails, returns
// NULL. The caller owns the created object on success.
-WebKit::WebInputEvent* CreateWebInputEvent(const PP_InputEvent& event);
WebKit::WebInputEvent* CreateWebInputEvent(
const ::ppapi::InputEventData& event);
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index dd4d663..cb9d192 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -73,6 +73,7 @@
#include "ppapi/c/trusted/ppb_file_io_trusted.h"
#include "ppapi/c/trusted/ppb_image_data_trusted.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
+#include "ppapi/shared_impl/input_event_impl.h"
#include "ppapi/shared_impl/time_conversion.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
@@ -107,6 +108,7 @@
using ppapi::thunk::EnterResource;
using ppapi::thunk::PPB_Graphics2D_API;
+using ppapi::InputEventData;
using ppapi::TimeTicksToPPTimeTicks;
using ppapi::TimeToPPTime;
@@ -209,11 +211,36 @@ uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
return ResourceTracker::Get()->GetLiveObjectsForInstance(instance_id);
}
+PP_Resource CreateKeyboardInputEvent(PP_Instance pp_instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks ticks,
+ uint32_t modifiers,
+ uint32_t key_code,
+ struct PP_Var char_text) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
+ if (!instance)
+ return 0;
+
+ 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) {
+ scoped_refptr<StringVar> char_text_string(StringVar::FromPPVar(char_text));
+ if (char_text_string.get())
+ data.character_text = char_text_string->value();
+ }
+ return PPB_InputEvent_Impl::Create(instance, data);
+}
+
const PPB_Testing_Dev testing_interface = {
&ReadImageData,
&RunMessageLoop,
&QuitMessageLoop,
- &GetLiveObjectsForInstance
+ &GetLiveObjectsForInstance,
+ &CreateKeyboardInputEvent
};
// GetInterface ----------------------------------------------------------------
diff --git a/webkit/plugins/ppapi/ppb_scrollbar_impl.cc b/webkit/plugins/ppapi/ppb_scrollbar_impl.cc
index 4b4c07b..1f80c06 100644
--- a/webkit/plugins/ppapi/ppb_scrollbar_impl.cc
+++ b/webkit/plugins/ppapi/ppb_scrollbar_impl.cc
@@ -161,14 +161,6 @@ void PPB_Scrollbar_Impl::ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) {
scrollbar_->scroll(direction, granularity, fmultiplier);
}
-PP_Bool PPB_Scrollbar_Impl::HandleEvent(const PP_InputEvent* event) {
- scoped_ptr<WebInputEvent> web_input_event(CreateWebInputEvent(*event));
- if (!web_input_event.get())
- return PP_FALSE;
-
- return PP_FromBool(scrollbar_->handleInputEvent(*web_input_event.get()));
-}
-
PP_Bool PPB_Scrollbar_Impl::PaintInternal(const gfx::Rect& rect,
PPB_ImageData_Impl* image) {
ImageDataAutoMapper mapper(image);
@@ -185,6 +177,15 @@ PP_Bool PPB_Scrollbar_Impl::PaintInternal(const gfx::Rect& rect,
return PP_TRUE;
}
+PP_Bool PPB_Scrollbar_Impl::HandleEventInternal(
+ const ::ppapi::InputEventData& data) {
+ scoped_ptr<WebInputEvent> web_input_event(CreateWebInputEvent(data));
+ if (!web_input_event.get())
+ return PP_FALSE;
+
+ return PP_FromBool(scrollbar_->handleInputEvent(*web_input_event.get()));
+}
+
void PPB_Scrollbar_Impl::SetLocationInternal(const PP_Rect* location) {
scrollbar_->setLocation(WebRect(location->point.x,
location->point.y,
diff --git a/webkit/plugins/ppapi/ppb_scrollbar_impl.h b/webkit/plugins/ppapi/ppb_scrollbar_impl.h
index f9bdda3..5712a02 100644
--- a/webkit/plugins/ppapi/ppb_scrollbar_impl.h
+++ b/webkit/plugins/ppapi/ppb_scrollbar_impl.h
@@ -41,13 +41,12 @@ class PPB_Scrollbar_Impl : public PPB_Widget_Impl,
virtual void SetTickMarks(const PP_Rect* tick_marks, uint32_t count) OVERRIDE;
virtual void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) OVERRIDE;
- // PPB_Widget public implementation.
- virtual PP_Bool HandleEvent(const PP_InputEvent* event) OVERRIDE;
-
private:
// PPB_Widget private implementation.
virtual PP_Bool PaintInternal(const gfx::Rect& rect,
PPB_ImageData_Impl* image) OVERRIDE;
+ virtual PP_Bool HandleEventInternal(
+ const ::ppapi::InputEventData& data) OVERRIDE;
virtual void SetLocationInternal(const PP_Rect* location) OVERRIDE;
// WebKit::WebScrollbarClient implementation.
diff --git a/webkit/plugins/ppapi/ppb_widget_impl.cc b/webkit/plugins/ppapi/ppb_widget_impl.cc
index 91bfea1..241b2c2 100644
--- a/webkit/plugins/ppapi/ppb_widget_impl.cc
+++ b/webkit/plugins/ppapi/ppb_widget_impl.cc
@@ -6,12 +6,15 @@
#include "ppapi/c/dev/ppp_widget_dev.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_input_event_api.h"
+#include "ppapi/thunk/ppb_widget_api.h"
#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/plugin_module.h"
using ppapi::thunk::EnterResourceNoLock;
using ppapi::thunk::PPB_ImageData_API;
+using ppapi::thunk::PPB_InputEvent_API;
using ppapi::thunk::PPB_Widget_API;
namespace webkit {
@@ -38,6 +41,13 @@ PP_Bool PPB_Widget_Impl::Paint(const PP_Rect* rect, PP_Resource image_id) {
static_cast<PPB_ImageData_Impl*>(enter.object()));
}
+PP_Bool PPB_Widget_Impl::HandleEvent(PP_Resource pp_input_event) {
+ EnterResourceNoLock<PPB_InputEvent_API> enter(pp_input_event, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return HandleEventInternal(enter.object()->GetInputEventData());
+}
+
PP_Bool PPB_Widget_Impl::GetLocation(PP_Rect* location) {
*location = location_;
return PP_TRUE;
diff --git a/webkit/plugins/ppapi/ppb_widget_impl.h b/webkit/plugins/ppapi/ppb_widget_impl.h
index 2cdc333..dda41d0 100644
--- a/webkit/plugins/ppapi/ppb_widget_impl.h
+++ b/webkit/plugins/ppapi/ppb_widget_impl.h
@@ -12,11 +12,13 @@
#include "webkit/plugins/ppapi/resource.h"
struct PPB_Widget_Dev;
-struct PP_InputEvent;
namespace gfx {
class Rect;
}
+namespace ppapi {
+struct InputEventData;
+}
namespace webkit {
namespace ppapi {
@@ -35,7 +37,7 @@ class PPB_Widget_Impl : public Resource,
// PPB_WidgetAPI implementation.
virtual PP_Bool Paint(const PP_Rect* rect, PP_Resource ) OVERRIDE;
- virtual PP_Bool HandleEvent(const PP_InputEvent* event) = 0;
+ virtual PP_Bool HandleEvent(PP_Resource pp_input_event) OVERRIDE;
virtual PP_Bool GetLocation(PP_Rect* location) OVERRIDE;
virtual void SetLocation(const PP_Rect* location) OVERRIDE;
@@ -45,6 +47,7 @@ class PPB_Widget_Impl : public Resource,
protected:
virtual PP_Bool PaintInternal(const gfx::Rect& rect,
PPB_ImageData_Impl* image) = 0;
+ virtual PP_Bool HandleEventInternal(const ::ppapi::InputEventData& data) = 0;
virtual void SetLocationInternal(const PP_Rect* location) = 0;
PP_Rect location() const { return location_; }