| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/shared_impl/input_event_impl.h" | 5 #include "ppapi/shared_impl/input_event_impl.h" |
| 6 | 6 |
| 7 #include "ppapi/shared_impl/tracker_base.h" | 7 #include "ppapi/shared_impl/tracker_base.h" |
| 8 #include "ppapi/shared_impl/var.h" | 8 #include "ppapi/shared_impl/var.h" |
| 9 | 9 |
| 10 using ppapi::thunk::PPB_InputEvent_API; | 10 using ppapi::thunk::PPB_InputEvent_API; |
| 11 | 11 |
| 12 namespace ppapi { | 12 namespace ppapi { |
| 13 | 13 |
| 14 InputEventData::InputEventData() | 14 InputEventData::InputEventData() |
| 15 : is_filtered(false), | 15 : is_filtered(false), |
| 16 event_type(PP_INPUTEVENT_TYPE_UNDEFINED), | 16 event_type(PP_INPUTEVENT_TYPE_UNDEFINED), |
| 17 event_time_stamp(0.0), | 17 event_time_stamp(0.0), |
| 18 event_modifiers(0), | 18 event_modifiers(0), |
| 19 mouse_button(PP_INPUTEVENT_MOUSEBUTTON_NONE), | 19 mouse_button(PP_INPUTEVENT_MOUSEBUTTON_NONE), |
| 20 mouse_position(PP_MakePoint(0, 0)), | 20 mouse_position(PP_MakePoint(0, 0)), |
| 21 mouse_click_count(0), | 21 mouse_click_count(0), |
| 22 mouse_movement(PP_MakePoint(0, 0)), |
| 22 wheel_delta(PP_MakeFloatPoint(0.0f, 0.0f)), | 23 wheel_delta(PP_MakeFloatPoint(0.0f, 0.0f)), |
| 23 wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)), | 24 wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)), |
| 24 wheel_scroll_by_page(false), | 25 wheel_scroll_by_page(false), |
| 25 key_code(0), | 26 key_code(0), |
| 26 character_text() { | 27 character_text() { |
| 27 } | 28 } |
| 28 | 29 |
| 29 InputEventData::~InputEventData() { | 30 InputEventData::~InputEventData() { |
| 30 } | 31 } |
| 31 | 32 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 69 } |
| 69 | 70 |
| 70 PP_Point InputEventImpl::GetMousePosition() { | 71 PP_Point InputEventImpl::GetMousePosition() { |
| 71 return data_.mouse_position; | 72 return data_.mouse_position; |
| 72 } | 73 } |
| 73 | 74 |
| 74 int32_t InputEventImpl::GetMouseClickCount() { | 75 int32_t InputEventImpl::GetMouseClickCount() { |
| 75 return data_.mouse_click_count; | 76 return data_.mouse_click_count; |
| 76 } | 77 } |
| 77 | 78 |
| 79 PP_Point InputEventImpl::GetMouseMovement() { |
| 80 return data_.mouse_movement; |
| 81 } |
| 82 |
| 78 PP_FloatPoint InputEventImpl::GetWheelDelta() { | 83 PP_FloatPoint InputEventImpl::GetWheelDelta() { |
| 79 return data_.wheel_delta; | 84 return data_.wheel_delta; |
| 80 } | 85 } |
| 81 | 86 |
| 82 PP_FloatPoint InputEventImpl::GetWheelTicks() { | 87 PP_FloatPoint InputEventImpl::GetWheelTicks() { |
| 83 return data_.wheel_ticks; | 88 return data_.wheel_ticks; |
| 84 } | 89 } |
| 85 | 90 |
| 86 PP_Bool InputEventImpl::GetWheelScrollByPage() { | 91 PP_Bool InputEventImpl::GetWheelScrollByPage() { |
| 87 return PP_FromBool(data_.wheel_scroll_by_page); | 92 return PP_FromBool(data_.wheel_scroll_by_page); |
| 88 } | 93 } |
| 89 | 94 |
| 90 uint32_t InputEventImpl::GetKeyCode() { | 95 uint32_t InputEventImpl::GetKeyCode() { |
| 91 return data_.key_code; | 96 return data_.key_code; |
| 92 } | 97 } |
| 93 | 98 |
| 94 PP_Var InputEventImpl::GetCharacterText() { | 99 PP_Var InputEventImpl::GetCharacterText() { |
| 95 return StringVar::StringToPPVar( | 100 return StringVar::StringToPPVar( |
| 96 TrackerBase::Get()->GetModuleForInstance(pp_instance()), | 101 TrackerBase::Get()->GetModuleForInstance(pp_instance()), |
| 97 data_.character_text); | 102 data_.character_text); |
| 98 } | 103 } |
| 99 | 104 |
| 100 } // namespace ppapi | 105 } // namespace ppapi |
| 101 | 106 |
| OLD | NEW |