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/cpp/input_event.h" | 5 #include "ppapi/cpp/input_event.h" |
6 | 6 |
7 #include "ppapi/cpp/instance_handle.h" | 7 #include "ppapi/cpp/instance_handle.h" |
8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
9 #include "ppapi/cpp/module_impl.h" | 9 #include "ppapi/cpp/module_impl.h" |
10 #include "ppapi/cpp/point.h" | 10 #include "ppapi/cpp/point.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 template <> const char* interface_name<PPB_WheelInputEvent_1_0>() { | 34 template <> const char* interface_name<PPB_WheelInputEvent_1_0>() { |
35 return PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0; | 35 return PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0; |
36 } | 36 } |
37 | 37 |
38 template <> const char* interface_name<PPB_TouchInputEvent_1_0>() { | 38 template <> const char* interface_name<PPB_TouchInputEvent_1_0>() { |
39 return PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0; | 39 return PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0; |
40 } | 40 } |
41 | 41 |
| 42 template <> |
| 43 const char* interface_name<PPB_TouchInputEvent_1_4>() { |
| 44 return PPB_TOUCH_INPUT_EVENT_INTERFACE_1_4; |
| 45 } |
| 46 |
42 template <> const char* interface_name<PPB_IMEInputEvent_1_0>() { | 47 template <> const char* interface_name<PPB_IMEInputEvent_1_0>() { |
43 return PPB_IME_INPUT_EVENT_INTERFACE_1_0; | 48 return PPB_IME_INPUT_EVENT_INTERFACE_1_0; |
44 } | 49 } |
45 | 50 |
46 } // namespace | 51 } // namespace |
47 | 52 |
48 // InputEvent ------------------------------------------------------------------ | 53 // InputEvent ------------------------------------------------------------------ |
49 | 54 |
50 InputEvent::InputEvent() : Resource() { | 55 InputEvent::InputEvent() : Resource() { |
51 } | 56 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 if (!has_interface<PPB_TouchInputEvent_1_0>()) | 322 if (!has_interface<PPB_TouchInputEvent_1_0>()) |
318 return 0; | 323 return 0; |
319 return get_interface<PPB_TouchInputEvent_1_0>()->GetTouchCount(pp_resource(), | 324 return get_interface<PPB_TouchInputEvent_1_0>()->GetTouchCount(pp_resource(), |
320 list); | 325 list); |
321 } | 326 } |
322 | 327 |
323 TouchPoint TouchInputEvent::GetTouchById(PP_TouchListType list, | 328 TouchPoint TouchInputEvent::GetTouchById(PP_TouchListType list, |
324 uint32_t id) const { | 329 uint32_t id) const { |
325 if (!has_interface<PPB_TouchInputEvent_1_0>()) | 330 if (!has_interface<PPB_TouchInputEvent_1_0>()) |
326 return TouchPoint(); | 331 return TouchPoint(); |
327 return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()-> | 332 |
328 GetTouchById(pp_resource(), list, id)); | 333 if (has_interface<PPB_TouchInputEvent_1_4>()) { |
| 334 return TouchPoint( |
| 335 get_interface<PPB_TouchInputEvent_1_4>()->GetTouchById(pp_resource(), |
| 336 list, id), |
| 337 get_interface<PPB_TouchInputEvent_1_4>()->GetTouchTiltById( |
| 338 pp_resource(), list, id)); |
| 339 } |
| 340 |
| 341 return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()->GetTouchById( |
| 342 pp_resource(), list, id)); |
329 } | 343 } |
330 | 344 |
331 TouchPoint TouchInputEvent::GetTouchByIndex(PP_TouchListType list, | 345 TouchPoint TouchInputEvent::GetTouchByIndex(PP_TouchListType list, |
332 uint32_t index) const { | 346 uint32_t index) const { |
333 if (!has_interface<PPB_TouchInputEvent_1_0>()) | 347 if (!has_interface<PPB_TouchInputEvent_1_0>()) |
334 return TouchPoint(); | 348 return TouchPoint(); |
| 349 |
| 350 if (has_interface<PPB_TouchInputEvent_1_4>()) { |
| 351 return TouchPoint( |
| 352 get_interface<PPB_TouchInputEvent_1_4>()->GetTouchByIndex(pp_resource(), |
| 353 list, index), |
| 354 get_interface<PPB_TouchInputEvent_1_4>()->GetTouchTiltByIndex( |
| 355 pp_resource(), list, index)); |
| 356 } |
| 357 |
335 return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()-> | 358 return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()-> |
336 GetTouchByIndex(pp_resource(), list, index)); | 359 GetTouchByIndex(pp_resource(), list, index)); |
337 } | 360 } |
338 | 361 |
339 // IMEInputEvent ------------------------------------------------------- | 362 // IMEInputEvent ------------------------------------------------------- |
340 | 363 |
341 IMEInputEvent::IMEInputEvent() : InputEvent() { | 364 IMEInputEvent::IMEInputEvent() : InputEvent() { |
342 } | 365 } |
343 | 366 |
344 IMEInputEvent::IMEInputEvent(const InputEvent& event) : InputEvent() { | 367 IMEInputEvent::IMEInputEvent(const InputEvent& event) : InputEvent() { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 429 |
407 void IMEInputEvent::GetSelection(uint32_t* start, uint32_t* end) const { | 430 void IMEInputEvent::GetSelection(uint32_t* start, uint32_t* end) const { |
408 if (has_interface<PPB_IMEInputEvent_1_0>()) { | 431 if (has_interface<PPB_IMEInputEvent_1_0>()) { |
409 get_interface<PPB_IMEInputEvent_1_0>()->GetSelection(pp_resource(), | 432 get_interface<PPB_IMEInputEvent_1_0>()->GetSelection(pp_resource(), |
410 start, | 433 start, |
411 end); | 434 end); |
412 } | 435 } |
413 } | 436 } |
414 | 437 |
415 } // namespace pp | 438 } // namespace pp |
OLD | NEW |