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

Unified Diff: ppapi/cpp/module.cc

Issue 7285010: Implement an input event resource. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months 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/cpp/module.cc
===================================================================
--- ppapi/cpp/module.cc (revision 90976)
+++ ppapi/cpp/module.cc (working copy)
@@ -27,17 +27,36 @@
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_var.h"
+#include "ppapi/c/ppp_input_event.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/ppp_messaging.h"
#include "ppapi/cpp/common.h"
-#include "ppapi/cpp/url_loader.h"
+#include "ppapi/cpp/input_event.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/resource.h"
+#include "ppapi/cpp/url_loader.h"
#include "ppapi/cpp/var.h"
namespace pp {
+// PPP_InputEvent implementation -----------------------------------------------
+
+PP_Bool InputEvent_HandleEvent(PP_Instance pp_instance, PP_Resource resource) {
+ Module* module_singleton = Module::Get();
+ if (!module_singleton)
+ return PP_FALSE;
+ Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
+ if (!instance)
+ return PP_FALSE;
+
+ return BoolToPPBool(instance->HandleInputEvent(InputEvent(resource)));
+}
+
+const PPP_InputEvent input_event_interface = {
+ &InputEvent_HandleEvent
+};
+
// PPP_Instance implementation -------------------------------------------------
PP_Bool Instance_DidCreate(PP_Instance pp_instance,
@@ -139,6 +158,8 @@
#endif
};
+// PPP_Messaging implementation ------------------------------------------------
+
void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) {
Module* module_singleton = Module::Get();
if (!module_singleton)
@@ -168,9 +189,10 @@
}
const void* Module::GetPluginInterface(const char* interface_name) {
+ if (strcmp(interface_name, PPP_INPUT_EVENT_INTERFACE) == 0)
+ return &input_event_interface;
if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0)
return &instance_interface;
-
if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0)
return &instance_messaging_interface;

Powered by Google App Engine
This is Rietveld 408576698