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

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
« ppapi/tests/test_input_event.cc ('K') | « ppapi/tests/test_input_event.cc ('k') | no next file » | 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 108154)
+++ webkit/plugins/ppapi/plugin_module.cc (working copy)
@@ -86,9 +86,17 @@
#include "ppapi/shared_impl/time_conversion.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
bbudge 2011/11/08 00:05:05 Most of these aren't needed anymore.
#include "webkit/plugins/plugin_switches.h"
#include "webkit/plugins/ppapi/callbacks.h"
#include "webkit/plugins/ppapi/common.h"
+#include "webkit/plugins/ppapi/event_conversion.h"
#include "webkit/plugins/ppapi/host_globals.h"
#include "webkit/plugins/ppapi/host_resource_tracker.h"
#include "webkit/plugins/ppapi/ppapi_interface_factory.h"
@@ -114,12 +122,18 @@
#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::EnterResourceNoLock;
using ppapi::thunk::PPB_Graphics2D_API;
+using ppapi::thunk::PPB_InputEvent_API;
+using WebKit::WebCursorInfo;
+using WebKit::WebInputEvent;
+
namespace webkit {
namespace ppapi {
@@ -222,12 +236,36 @@
return PP_FALSE;
}
+void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
+ PluginInstance* plugin_instance = host_globals->GetInstance(instance);
+ if (!plugin_instance) {
+ NOTREACHED();
+ return;
+ }
+ EnterResourceNoLock<PPB_InputEvent_API> enter(input_event, false);
dmichael (off chromium) 2011/11/07 17:12:58 We should probably be consistent and use EnterReso
bbudge 2011/11/08 00:05:05 Done.
+ if (enter.failed()) {
+ NOTREACHED();
+ return;
+ }
+ const InputEventData& data = enter.object()->GetInputEventData();
+ scoped_ptr<WebInputEvent> web_input_event(
+ CreateWebInputEvent(data));
+
+ // Route the event back through the plugin, rather than through the entire
+ // renderer, to avoid the complex event logic there.
+ // TODO(bbudge) For "user gesture" events, create a user gesture indicator
+ // here so we can write automated tests for functionality that requires one.
+ WebCursorInfo cursor_info;
+ plugin_instance->HandleInputEvent(*web_input_event.get(), &cursor_info);
+}
+
const PPB_Testing_Dev testing_interface = {
&ReadImageData,
&RunMessageLoop,
&QuitMessageLoop,
&GetLiveObjectsForInstance,
- &IsOutOfProcess
+ &IsOutOfProcess,
+ &SimulateInputEvent
};
// GetInterface ----------------------------------------------------------------
« ppapi/tests/test_input_event.cc ('K') | « ppapi/tests/test_input_event.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698