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

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: . 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/thunk/ppb_input_event_api.h ('k') | webkit/plugins/ppapi/event_conversion.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7d527a6ef540f3afdcd9be715a491ecc1e1f1836 100644
--- a/ppapi/thunk/ppb_input_event_thunk.cc
+++ b/ppapi/thunk/ppb_input_event_thunk.cc
@@ -3,11 +3,11 @@
// found in the LICENSE file.
#include "ppapi/c/pp_errors.h"
-#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_input_event_api.h"
#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
@@ -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
« no previous file with comments | « ppapi/thunk/ppb_input_event_api.h ('k') | webkit/plugins/ppapi/event_conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698