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

Unified Diff: ppapi/thunk/ppb_input_event_thunk.cc

Issue 10543159: ppapi: Add support for touch events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: idl-goodness 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
Index: ppapi/thunk/ppb_input_event_thunk.cc
diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc
index 47f9e51f325f3387fc5372f6d523a8b77fccbeaa..aaddf8ecbd19f4692a51c5a28a998f6145f60af3 100644
--- a/ppapi/thunk/ppb_input_event_thunk.cc
+++ b/ppapi/thunk/ppb_input_event_thunk.cc
@@ -379,6 +379,72 @@ const PPB_IMEInputEvent_Dev_0_2 g_ppb_ime_input_event_0_2_thunk = {
&GetIMESelection
};
+// Touch -----------------------------------------------------------------------
+
+PP_Resource CreateTouchInputEvent(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ // TODO(sad):
+ return 0;
+}
+
+void AddTouchPoint(PP_Resource touch_event,
+ PP_TouchListType list,
+ const PP_TouchPoint* point) {
+ EnterInputEvent enter(touch_event, true);
+ if (enter.failed())
+ return;
+ return enter.object()->AddTouchPoint(list, *point);
+}
+
+PP_Bool IsTouchInputEvent(PP_Resource resource) {
+ if (!IsInputEvent(resource))
+ return PP_FALSE; // Prevent warning log in GetType.
+ PP_InputEvent_Type type = GetType(resource);
+ return PP_FromBool(type == PP_INPUTEVENT_TYPE_TOUCHSTART ||
+ type == PP_INPUTEVENT_TYPE_TOUCHMOVE ||
+ type == PP_INPUTEVENT_TYPE_TOUCHEND ||
+ type == PP_INPUTEVENT_TYPE_TOUCHCANCEL);
+}
+
+uint32_t GetTouchCount(PP_Resource touch_event, PP_TouchListType list) {
+ EnterInputEvent enter(touch_event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetTouchCount(list);
+}
+
+struct PP_TouchPoint GetTouchByIndex(PP_Resource touch_event,
+ PP_TouchListType list,
+ uint32_t index) {
+ EnterInputEvent enter(touch_event, true);
+ if (enter.failed())
+ return PP_MakeTouchPoint();
+ return enter.object()->GetTouchByIndex(list, index);
+}
+
+struct PP_TouchPoint GetTouchById(PP_Resource touch_event,
+ PP_TouchListType list,
+ uint32_t id) {
+ EnterInputEvent enter(touch_event, true);
+ if (enter.failed())
+ return PP_MakeTouchPoint();
+ return enter.object()->GetTouchById(list, id);
+}
+
+const PPB_TouchInputEvent_1_0 g_ppb_touch_input_event_thunk = {
+ &CreateTouchInputEvent,
+ &AddTouchPoint,
+ &IsTouchInputEvent,
+ &GetTouchCount,
+ &GetTouchByIndex,
+ &GetTouchById
+};
+
} // namespace
const PPB_InputEvent_1_0* GetPPB_InputEvent_1_0_Thunk() {
@@ -414,5 +480,9 @@ const PPB_IMEInputEvent_Dev_0_2* GetPPB_IMEInputEvent_Dev_0_2_Thunk() {
return &g_ppb_ime_input_event_0_2_thunk;
}
+const PPB_TouchInputEvent_1_0* GetPPB_TouchInputEvent_Thunk() {
+ return &g_ppb_touch_input_event_thunk;
+}
+
} // namespace thunk
} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698