OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ppapi/cpp/module_impl.h" |
| 6 #include "ppapi/cpp/point.h" |
| 7 #include "ppapi/cpp/dev/touch_event_dev.h" |
| 8 |
| 9 namespace pp { |
| 10 |
| 11 namespace { |
| 12 |
| 13 template <> const char* interface_name<PPB_TouchInputEvent_Dev>() { |
| 14 return PPB_TOUCH_INPUT_EVENT_DEV_INTERFACE; |
| 15 } |
| 16 |
| 17 } // namespace |
| 18 |
| 19 TouchInputEvent_Dev::TouchInputEvent_Dev(const InputEvent& event) |
| 20 : InputEvent() { |
| 21 if (!has_interface<PPB_TouchInputEvent_Dev>()) |
| 22 return; |
| 23 // Type check the input event before setting it. |
| 24 if (get_interface<PPB_TouchInputEvent_Dev>()->IsTouchInputEvent( |
| 25 event.pp_resource())) { |
| 26 Module::Get()->core()->AddRefResource(event.pp_resource()); |
| 27 PassRefFromConstructor(event.pp_resource()); |
| 28 } |
| 29 } |
| 30 |
| 31 uint32_t TouchInputEvent_Dev::GetTouchCount(PP_TouchListType list) const { |
| 32 if (!has_interface<PPB_TouchInputEvent_Dev>()) |
| 33 return 0; |
| 34 return get_interface<PPB_TouchInputEvent_Dev>()->GetTouchCount(pp_resource(), |
| 35 list); |
| 36 } |
| 37 |
| 38 TouchPoint_Dev TouchInputEvent_Dev::GetTouchById(PP_TouchListType list, |
| 39 uint32_t id) const { |
| 40 if (!has_interface<PPB_TouchInputEvent_Dev>()) |
| 41 return TouchPoint_Dev(); |
| 42 return TouchPoint_Dev(get_interface<PPB_TouchInputEvent_Dev>()-> |
| 43 GetTouchById(pp_resource(), list, id)); |
| 44 } |
| 45 |
| 46 TouchPoint_Dev TouchInputEvent_Dev::GetTouchByIndex(PP_TouchListType list, |
| 47 uint32_t index) const { |
| 48 if (!has_interface<PPB_TouchInputEvent_Dev>()) |
| 49 return TouchPoint_Dev(); |
| 50 return TouchPoint_Dev(get_interface<PPB_TouchInputEvent_Dev>()-> |
| 51 GetTouchByIndex(pp_resource(), list, index)); |
| 52 } |
| 53 |
| 54 } // namespace pp |
OLD | NEW |