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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 if (!has_interface<PPB_TouchInputEvent_1_0>()) | 317 if (!has_interface<PPB_TouchInputEvent_1_0>()) |
318 return 0; | 318 return 0; |
319 return get_interface<PPB_TouchInputEvent_1_0>()->GetTouchCount(pp_resource(), | 319 return get_interface<PPB_TouchInputEvent_1_0>()->GetTouchCount(pp_resource(), |
320 list); | 320 list); |
321 } | 321 } |
322 | 322 |
323 TouchPoint TouchInputEvent::GetTouchById(PP_TouchListType list, | 323 TouchPoint TouchInputEvent::GetTouchById(PP_TouchListType list, |
324 uint32_t id) const { | 324 uint32_t id) const { |
325 if (!has_interface<PPB_TouchInputEvent_1_0>()) | 325 if (!has_interface<PPB_TouchInputEvent_1_0>()) |
326 return TouchPoint(); | 326 return TouchPoint(); |
327 return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()-> | 327 |
328 GetTouchById(pp_resource(), list, id)); | 328 if (has_interface<PPB_TouchInputEvent_1_1>()) { |
| 329 return TouchPoint( |
| 330 get_interface<PPB_TouchInputEvent_1_1>()->GetTouchById(pp_resource(), |
| 331 list, id), |
| 332 get_interface<PPB_TouchInputEvent_1_1>()->GetTouchTiltById( |
| 333 pp_resource(), list, id)); |
| 334 } |
| 335 |
| 336 return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()->GetTouchById( |
| 337 pp_resource(), list, id)); |
329 } | 338 } |
330 | 339 |
331 TouchPoint TouchInputEvent::GetTouchByIndex(PP_TouchListType list, | 340 TouchPoint TouchInputEvent::GetTouchByIndex(PP_TouchListType list, |
332 uint32_t index) const { | 341 uint32_t index) const { |
333 if (!has_interface<PPB_TouchInputEvent_1_0>()) | 342 if (!has_interface<PPB_TouchInputEvent_1_0>()) |
334 return TouchPoint(); | 343 return TouchPoint(); |
| 344 |
| 345 if (has_interface<PPB_TouchInputEvent_1_1>()) { |
| 346 return TouchPoint( |
| 347 get_interface<PPB_TouchInputEvent_1_1>()->GetTouchByIndex(pp_resource(), |
| 348 list, index), |
| 349 get_interface<PPB_TouchInputEvent_1_1>()->GetTouchTiltByIndex( |
| 350 pp_resource(), list, index)); |
| 351 } |
| 352 |
335 return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()-> | 353 return TouchPoint(get_interface<PPB_TouchInputEvent_1_0>()-> |
336 GetTouchByIndex(pp_resource(), list, index)); | 354 GetTouchByIndex(pp_resource(), list, index)); |
337 } | 355 } |
338 | 356 |
339 // IMEInputEvent ------------------------------------------------------- | 357 // IMEInputEvent ------------------------------------------------------- |
340 | 358 |
341 IMEInputEvent::IMEInputEvent() : InputEvent() { | 359 IMEInputEvent::IMEInputEvent() : InputEvent() { |
342 } | 360 } |
343 | 361 |
344 IMEInputEvent::IMEInputEvent(const InputEvent& event) : InputEvent() { | 362 IMEInputEvent::IMEInputEvent(const InputEvent& event) : InputEvent() { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 424 |
407 void IMEInputEvent::GetSelection(uint32_t* start, uint32_t* end) const { | 425 void IMEInputEvent::GetSelection(uint32_t* start, uint32_t* end) const { |
408 if (has_interface<PPB_IMEInputEvent_1_0>()) { | 426 if (has_interface<PPB_IMEInputEvent_1_0>()) { |
409 get_interface<PPB_IMEInputEvent_1_0>()->GetSelection(pp_resource(), | 427 get_interface<PPB_IMEInputEvent_1_0>()->GetSelection(pp_resource(), |
410 start, | 428 start, |
411 end); | 429 end); |
412 } | 430 } |
413 } | 431 } |
414 | 432 |
415 } // namespace pp | 433 } // namespace pp |
OLD | NEW |