Index: ppapi/proxy/ppb_testing_proxy.cc |
=================================================================== |
--- ppapi/proxy/ppb_testing_proxy.cc (revision 108154) |
+++ ppapi/proxy/ppb_testing_proxy.cc (working copy) |
@@ -7,6 +7,7 @@ |
#include "base/message_loop.h" |
#include "ppapi/c/dev/ppb_testing_dev.h" |
#include "ppapi/proxy/plugin_dispatcher.h" |
+#include "ppapi/proxy/plugin_globals.h" |
#include "ppapi/proxy/ppapi_messages.h" |
#include "ppapi/shared_impl/ppapi_globals.h" |
#include "ppapi/shared_impl/resource.h" |
@@ -68,12 +69,23 @@ |
return PP_TRUE; |
} |
+void SimulateInputEvent(PP_Instance instance_id, PP_Resource input_event) { |
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); |
+ if (!dispatcher) |
+ return; |
+ HostResource input_event_resource; |
+ input_event_resource.SetHostResource(instance_id, input_event); |
+ dispatcher->Send(new PpapiHostMsg_PPBTesting_SimulateInputEvent( |
+ API_ID_PPB_TESTING, instance_id, input_event_resource)); |
+} |
+ |
const PPB_Testing_Dev testing_interface = { |
&ReadImageData, |
&RunMessageLoop, |
&QuitMessageLoop, |
&GetLiveObjectsForInstance, |
- &IsOutOfProcess |
+ &IsOutOfProcess, |
+ &SimulateInputEvent |
}; |
InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) { |
@@ -113,6 +125,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 +154,14 @@ |
*result = ppb_testing_impl_->GetLiveObjectsForInstance(instance); |
} |
+void PPB_Testing_Proxy::OnMsgSimulateInputEvent( |
+ PP_Instance instance, |
+ const ppapi::HostResource& input_event) { |
+ PP_Resource plugin_input_event = |
+ PluginGlobals::Get()->plugin_resource_tracker()-> |
+ PluginResourceForHostResource(input_event); |
+ ppb_testing_impl_->SimulateInputEvent(instance, plugin_input_event); |
+} |
+ |
} // namespace proxy |
} // namespace ppapi |