Chromium Code Reviews| 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..b6a76d0f715945a321178779b5c4db455d958280 100644 |
| --- a/ppapi/thunk/ppb_input_event_thunk.cc |
| +++ b/ppapi/thunk/ppb_input_event_thunk.cc |
| @@ -379,6 +379,52 @@ const PPB_IMEInputEvent_Dev_0_2 g_ppb_ime_input_event_0_2_thunk = { |
| &GetIMESelection |
| }; |
| +// Touch ----------------------------------------------------------------------- |
| + |
| +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_Dev GetTouchByIndex(PP_Resource touch_event, |
| + PP_TouchListType list, |
| + uint32_t index) { |
| + EnterInputEvent enter(touch_event, true); |
| + if (enter.failed()) { |
|
brettw
2012/06/19 21:20:52
No {}. Same on the next fn.
sadrul
2012/06/20 20:19:03
Done.
|
| + return PP_MakeTouchPoint(); |
| + } |
| + return enter.object()->GetTouchByIndex(list, index); |
| +} |
| + |
| +struct PP_TouchPoint_Dev 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_Dev g_ppb_touch_input_event_thunk = { |
| + &IsTouchInputEvent, |
| + &GetTouchCount, |
| + &GetTouchByIndex, |
| + &GetTouchById |
| +}; |
| + |
| } // namespace |
| const PPB_InputEvent_1_0* GetPPB_InputEvent_1_0_Thunk() { |
| @@ -414,5 +460,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_Dev* GetPPB_TouchInputEvent_Thunk() { |
| + return &g_ppb_touch_input_event_thunk; |
| +} |
| + |
| } // namespace thunk |
| } // namespace ppapi |