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

Unified Diff: ppapi/proxy/ppb_testing_proxy.cc

Issue 8413021: Add functions to generate input events to PPB_Testing_Dev. These make (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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/proxy/ppb_testing_proxy.h ('k') | ppapi/tests/test_input_event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_testing_proxy.cc
===================================================================
--- ppapi/proxy/ppb_testing_proxy.cc (revision 110856)
+++ ppapi/proxy/ppb_testing_proxy.cc (working copy)
@@ -6,12 +6,18 @@
#include "base/message_loop.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/proxy/enter_proxy.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/resource.h"
#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_input_event_api.h"
+using ppapi::thunk::EnterResource;
+using ppapi::thunk::PPB_InputEvent_API;
+
namespace ppapi {
namespace proxy {
@@ -68,12 +74,26 @@
return PP_TRUE;
}
+void SimulateInputEvent(PP_Instance instance_id, PP_Resource input_event) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
+ if (!dispatcher)
+ return;
+ EnterResource<PPB_InputEvent_API> enter(input_event, false);
+ if (enter.failed())
+ return;
+
+ const InputEventData& input_event_data = enter.object()->GetInputEventData();
+ dispatcher->Send(new PpapiHostMsg_PPBTesting_SimulateInputEvent(
+ API_ID_PPB_TESTING, instance_id, input_event_data));
+}
+
const PPB_Testing_Dev testing_interface = {
&ReadImageData,
&RunMessageLoop,
&QuitMessageLoop,
&GetLiveObjectsForInstance,
- &IsOutOfProcess
+ &IsOutOfProcess,
+ &SimulateInputEvent
};
InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) {
@@ -113,6 +133,8 @@
OnMsgReadImageData)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance,
OnMsgGetLiveObjectsForInstance)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_SimulateInputEvent,
+ OnMsgSimulateInputEvent)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -140,5 +162,16 @@
*result = ppb_testing_impl_->GetLiveObjectsForInstance(instance);
}
+void PPB_Testing_Proxy::OnMsgSimulateInputEvent(
+ PP_Instance instance,
+ const InputEventData& input_event) {
+ scoped_refptr<InputEventImpl> input_event_impl(
+ new InputEventImpl(InputEventImpl::InitAsProxy(),
+ instance,
+ input_event));
+ ppb_testing_impl_->SimulateInputEvent(instance,
+ input_event_impl->pp_resource());
+}
+
} // namespace proxy
} // namespace ppapi
« no previous file with comments | « ppapi/proxy/ppb_testing_proxy.h ('k') | ppapi/tests/test_input_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698