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

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
Index: ppapi/proxy/ppb_testing_proxy.cc
===================================================================
--- ppapi/proxy/ppb_testing_proxy.cc (revision 110829)
+++ 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,28 @@
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()) {
+ NOTREACHED();
piman 2011/11/19 22:31:00 Not NOTREACHED() here. It is reachable by an incor
bbudge 2011/11/20 02:53:57 Done. This code idiom was copied from ppp_input_ev
piman 2011/11/20 04:36:49 I think over there it's ok to have: the call is in
+ 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 +135,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 +164,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));
piman 2011/11/19 22:31:00 So what you're doing here is unexpected. The plugi
bbudge 2011/11/20 02:53:57 I tried that but couldn't get it to work (CLs befo
piman 2011/11/20 04:36:49 I see, ok, that's fine then.
+ ppb_testing_impl_->SimulateInputEvent(instance,
+ input_event_impl->pp_resource());
+}
+
} // namespace proxy
} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698