| 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
|
|
|