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

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
Index: webkit/plugins/ppapi/plugin_module.cc
===================================================================
--- webkit/plugins/ppapi/plugin_module.cc (revision 110385)
+++ webkit/plugins/ppapi/plugin_module.cc (working copy)
@@ -115,11 +115,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 {
@@ -223,12 +225,28 @@
return PP_FALSE;
}
+void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
+ PluginInstance* plugin_instance = host_globals->GetInstance(instance);
+ if (!plugin_instance) {
+ NOTREACHED();
+ return;
+ }
+ EnterResource<PPB_InputEvent_API> enter(input_event, false);
+ if (enter.failed()) {
+ NOTREACHED();
+ 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 ----------------------------------------------------------------
@@ -320,10 +338,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)) {
dmichael (off chromium) 2011/11/18 03:44:45 Ah, nice catch. I meant the line above, though :-)
bbudge 2011/11/18 19:00:06 Done.
+ if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0 ||
+ strcmp(name, PPB_TESTING_DEV_INTERFACE_0_7) == 0) {
return &testing_interface;
+ }
}
return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698