Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
| 6 #include "ppapi/thunk/thunk.h" | 6 #include "ppapi/thunk/thunk.h" |
| 7 #include "ppapi/thunk/enter.h" | 7 #include "ppapi/thunk/enter.h" |
| 8 #include "ppapi/thunk/ppb_input_event_api.h" | 8 #include "ppapi/thunk/ppb_input_event_api.h" |
| 9 #include "ppapi/thunk/ppb_instance_api.h" | 9 #include "ppapi/thunk/ppb_instance_api.h" |
| 10 #include "ppapi/thunk/resource_creation_api.h" | 10 #include "ppapi/thunk/resource_creation_api.h" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 const PPB_IMEInputEvent_Dev_0_2 g_ppb_ime_input_event_0_2_thunk = { | 372 const PPB_IMEInputEvent_Dev_0_2 g_ppb_ime_input_event_0_2_thunk = { |
| 373 &CreateIMEInputEvent, | 373 &CreateIMEInputEvent, |
| 374 &IsIMEInputEvent, | 374 &IsIMEInputEvent, |
| 375 &GetIMEText, | 375 &GetIMEText, |
| 376 &GetIMESegmentNumber, | 376 &GetIMESegmentNumber, |
| 377 &GetIMESegmentOffset, | 377 &GetIMESegmentOffset, |
| 378 &GetIMETargetSegment, | 378 &GetIMETargetSegment, |
| 379 &GetIMESelection | 379 &GetIMESelection |
| 380 }; | 380 }; |
| 381 | 381 |
| 382 // Touch ----------------------------------------------------------------------- | |
| 383 | |
| 384 PP_Bool IsTouchInputEvent(PP_Resource resource) { | |
| 385 if (!IsInputEvent(resource)) | |
| 386 return PP_FALSE; // Prevent warning log in GetType. | |
| 387 PP_InputEvent_Type type = GetType(resource); | |
| 388 return PP_FromBool(type == PP_INPUTEVENT_TYPE_TOUCHSTART || | |
| 389 type == PP_INPUTEVENT_TYPE_TOUCHMOVE || | |
| 390 type == PP_INPUTEVENT_TYPE_TOUCHEND || | |
| 391 type == PP_INPUTEVENT_TYPE_TOUCHCANCEL); | |
| 392 } | |
| 393 | |
| 394 uint32_t GetTouchCount(PP_Resource touch_event, PP_TouchListType list) { | |
| 395 EnterInputEvent enter(touch_event, true); | |
| 396 if (enter.failed()) | |
| 397 return 0; | |
| 398 return enter.object()->GetTouchCount(list); | |
| 399 } | |
| 400 | |
| 401 struct PP_TouchPoint_Dev GetTouchByIndex(PP_Resource touch_event, | |
| 402 PP_TouchListType list, | |
| 403 uint32_t index) { | |
| 404 EnterInputEvent enter(touch_event, true); | |
| 405 if (enter.failed()) { | |
|
brettw
2012/06/19 21:20:52
No {}. Same on the next fn.
sadrul
2012/06/20 20:19:03
Done.
| |
| 406 return PP_MakeTouchPoint(); | |
| 407 } | |
| 408 return enter.object()->GetTouchByIndex(list, index); | |
| 409 } | |
| 410 | |
| 411 struct PP_TouchPoint_Dev GetTouchById(PP_Resource touch_event, | |
| 412 PP_TouchListType list, | |
| 413 uint32_t id) { | |
| 414 EnterInputEvent enter(touch_event, true); | |
| 415 if (enter.failed()) { | |
| 416 return PP_MakeTouchPoint(); | |
| 417 } | |
| 418 return enter.object()->GetTouchById(list, id); | |
| 419 } | |
| 420 | |
| 421 const PPB_TouchInputEvent_Dev g_ppb_touch_input_event_thunk = { | |
| 422 &IsTouchInputEvent, | |
| 423 &GetTouchCount, | |
| 424 &GetTouchByIndex, | |
| 425 &GetTouchById | |
| 426 }; | |
| 427 | |
| 382 } // namespace | 428 } // namespace |
| 383 | 429 |
| 384 const PPB_InputEvent_1_0* GetPPB_InputEvent_1_0_Thunk() { | 430 const PPB_InputEvent_1_0* GetPPB_InputEvent_1_0_Thunk() { |
| 385 return &g_ppb_input_event_thunk; | 431 return &g_ppb_input_event_thunk; |
| 386 } | 432 } |
| 387 | 433 |
| 388 const PPB_MouseInputEvent_1_0* GetPPB_MouseInputEvent_1_0_Thunk() { | 434 const PPB_MouseInputEvent_1_0* GetPPB_MouseInputEvent_1_0_Thunk() { |
| 389 return &g_ppb_mouse_input_event_1_0_thunk; | 435 return &g_ppb_mouse_input_event_1_0_thunk; |
| 390 } | 436 } |
| 391 | 437 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 407 } | 453 } |
| 408 | 454 |
| 409 const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() { | 455 const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() { |
| 410 return &g_ppb_ime_input_event_0_1_thunk; | 456 return &g_ppb_ime_input_event_0_1_thunk; |
| 411 } | 457 } |
| 412 | 458 |
| 413 const PPB_IMEInputEvent_Dev_0_2* GetPPB_IMEInputEvent_Dev_0_2_Thunk() { | 459 const PPB_IMEInputEvent_Dev_0_2* GetPPB_IMEInputEvent_Dev_0_2_Thunk() { |
| 414 return &g_ppb_ime_input_event_0_2_thunk; | 460 return &g_ppb_ime_input_event_0_2_thunk; |
| 415 } | 461 } |
| 416 | 462 |
| 463 const PPB_TouchInputEvent_Dev* GetPPB_TouchInputEvent_Thunk() { | |
| 464 return &g_ppb_touch_input_event_thunk; | |
| 465 } | |
| 466 | |
| 417 } // namespace thunk | 467 } // namespace thunk |
| 418 } // namespace ppapi | 468 } // namespace ppapi |
| OLD | NEW |