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

Unified Diff: ppapi/cpp/input_event.cc

Issue 10543159: ppapi: Add support for touch events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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
« no previous file with comments | « ppapi/cpp/input_event.h ('k') | ppapi/cpp/touch_point.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/input_event.cc
diff --git a/ppapi/cpp/input_event.cc b/ppapi/cpp/input_event.cc
index c78095d1401ee053847484e04266c969b46a0509..409585e0efcbd78a2c9353cffc8263fabb97d35c 100644
--- a/ppapi/cpp/input_event.cc
+++ b/ppapi/cpp/input_event.cc
@@ -8,6 +8,7 @@
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/module_impl.h"
#include "ppapi/cpp/point.h"
+#include "ppapi/cpp/touch_point.h"
#include "ppapi/cpp/var.h"
namespace pp {
@@ -218,4 +219,50 @@ Var KeyboardInputEvent::GetCharacterText() const {
pp_resource()));
}
+// TouchInputEvent ------------------------------------------------------------
+TouchInputEvent::TouchInputEvent() : InputEvent() {
+}
+
+TouchInputEvent::TouchInputEvent(const InputEvent& event) : InputEvent() {
+ if (!has_interface<PPB_TouchInputEvent_1_0>())
+ return;
+ // Type check the input event before setting it.
+ if (get_interface<PPB_TouchInputEvent_1_0>()->IsTouchInputEvent(
+ event.pp_resource())) {
+ Module::Get()->core()->AddRefResource(event.pp_resource());
+ PassRefFromConstructor(event.pp_resource());
+ }
+}
+
+void TouchInputEvent::AddTouchPoint(PP_TouchListType list,
+ PP_TouchPoint point) {
+ if (!has_interface<PPB_TouchInputEvent_1_0>())
+ return;
+ get_interface<PPB_TouchInputEvent_1_0>()->AddTouchPoint(pp_resource(), list,
+ &point);
+}
+
+uint32_t TouchInputEvent::GetTouchCount(PP_TouchListType list) const {
+ if (!has_interface<PPB_TouchInputEvent_1_0>())
+ return 0;
+ return get_interface<PPB_TouchInputEvent_1_0>()->GetTouchCount(pp_resource(),
+ list);
+}
+
+TouchPoint TouchInputEvent::GetTouchById(PP_TouchListType list,
+ uint32_t id) const {
+ if (!has_interface<PPB_TouchInputEvent_1_0>())
+ return TouchPoint();
+ return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()->
+ GetTouchById(pp_resource(), list, id));
+}
+
+TouchPoint TouchInputEvent::GetTouchByIndex(PP_TouchListType list,
+ uint32_t index) const {
+ if (!has_interface<PPB_TouchInputEvent_1_0>())
+ return TouchPoint();
+ return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()->
+ GetTouchByIndex(pp_resource(), list, index));
+}
+
} // namespace pp
« no previous file with comments | « ppapi/cpp/input_event.h ('k') | ppapi/cpp/touch_point.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698