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

Unified Diff: webkit/plugins/ppapi/plugin_module.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 | « webkit/plugins/ppapi/event_conversion.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/plugin_module.cc
===================================================================
--- webkit/plugins/ppapi/plugin_module.cc (revision 110856)
+++ webkit/plugins/ppapi/plugin_module.cc (working copy)
@@ -117,11 +117,13 @@
#include "webkit/plugins/ppapi/ppb_video_layer_impl.h"
#include "webkit/plugins/ppapi/webkit_forwarding_impl.h"
+using ppapi::InputEventData;
using ppapi::PpapiGlobals;
using ppapi::TimeTicksToPPTimeTicks;
using ppapi::TimeToPPTime;
using ppapi::thunk::EnterResource;
using ppapi::thunk::PPB_Graphics2D_API;
+using ppapi::thunk::PPB_InputEvent_API;
namespace webkit {
namespace ppapi {
@@ -225,12 +227,26 @@
return PP_FALSE;
}
+void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
+ PluginInstance* plugin_instance = host_globals->GetInstance(instance);
+ if (!plugin_instance)
+ return;
+
+ EnterResource<PPB_InputEvent_API> enter(input_event, false);
+ if (enter.failed())
+ return;
+
+ const InputEventData& input_event_data = enter.object()->GetInputEventData();
+ plugin_instance->SimulateInputEvent(input_event_data);
+}
+
const PPB_Testing_Dev testing_interface = {
&ReadImageData,
&RunMessageLoop,
&QuitMessageLoop,
&GetLiveObjectsForInstance,
- &IsOutOfProcess
+ &IsOutOfProcess,
+ &SimulateInputEvent
};
// GetInterface ----------------------------------------------------------------
@@ -324,10 +340,12 @@
// Only support the testing interface when the command line switch is
// specified. This allows us to prevent people from (ab)using this interface
// in production code.
- if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnablePepperTesting))
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnablePepperTesting)) {
+ if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0 ||
+ strcmp(name, PPB_TESTING_DEV_INTERFACE_0_7) == 0) {
return &testing_interface;
+ }
}
return NULL;
}
« no previous file with comments | « webkit/plugins/ppapi/event_conversion.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698