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" |
| 8 #include "ppapi/shared_impl/var.h" |
| 9 |
| 10 using ppapi::thunk::PPB_InputEvent_API; |
| 11 |
7 namespace ppapi { | 12 namespace ppapi { |
8 | 13 |
9 InputEventData::InputEventData() | 14 InputEventData::InputEventData() |
10 : is_filtered(false), | 15 : is_filtered(false), |
11 event_type(PP_INPUTEVENT_TYPE_UNDEFINED), | 16 event_type(PP_INPUTEVENT_TYPE_UNDEFINED), |
12 event_time_stamp(0.0), | 17 event_time_stamp(0.0), |
13 event_modifiers(0), | 18 event_modifiers(0), |
14 mouse_button(PP_INPUTEVENT_MOUSEBUTTON_NONE), | 19 mouse_button(PP_INPUTEVENT_MOUSEBUTTON_NONE), |
15 mouse_position(PP_MakePoint(0, 0)), | 20 mouse_position(PP_MakePoint(0, 0)), |
16 mouse_click_count(0), | 21 mouse_click_count(0), |
17 wheel_delta(PP_MakeFloatPoint(0.0f, 0.0f)), | 22 wheel_delta(PP_MakeFloatPoint(0.0f, 0.0f)), |
18 wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)), | 23 wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)), |
19 wheel_scroll_by_page(false), | 24 wheel_scroll_by_page(false), |
20 key_code(0), | 25 key_code(0), |
21 character_text() { | 26 character_text() { |
22 } | 27 } |
23 | 28 |
24 InputEventData::~InputEventData() { | 29 InputEventData::~InputEventData() { |
25 } | 30 } |
26 | 31 |
27 InputEventImpl::InputEventImpl(const InputEventData& data) : data_(data) { | 32 InputEventImpl::InputEventImpl(const InitAsImpl&, |
| 33 PP_Instance instance, |
| 34 const InputEventData& data) |
| 35 : Resource(instance), |
| 36 data_(data) { |
| 37 } |
| 38 |
| 39 InputEventImpl::InputEventImpl(const InitAsProxy&, |
| 40 PP_Instance instance, |
| 41 const InputEventData& data) |
| 42 : Resource(HostResource::MakeInstanceOnly(instance)), |
| 43 data_(data) { |
| 44 } |
| 45 |
| 46 PPB_InputEvent_API* InputEventImpl::AsPPB_InputEvent_API() { |
| 47 return this; |
28 } | 48 } |
29 | 49 |
30 const InputEventData& InputEventImpl::GetInputEventData() const { | 50 const InputEventData& InputEventImpl::GetInputEventData() const { |
31 return data_; | 51 return data_; |
32 } | 52 } |
33 | 53 |
34 PP_InputEvent_Type InputEventImpl::GetType() { | 54 PP_InputEvent_Type InputEventImpl::GetType() { |
35 return data_.event_type; | 55 return data_.event_type; |
36 } | 56 } |
37 | 57 |
(...skipping 27 matching lines...) Expand all Loading... |
65 | 85 |
66 PP_Bool InputEventImpl::GetWheelScrollByPage() { | 86 PP_Bool InputEventImpl::GetWheelScrollByPage() { |
67 return PP_FromBool(data_.wheel_scroll_by_page); | 87 return PP_FromBool(data_.wheel_scroll_by_page); |
68 } | 88 } |
69 | 89 |
70 uint32_t InputEventImpl::GetKeyCode() { | 90 uint32_t InputEventImpl::GetKeyCode() { |
71 return data_.key_code; | 91 return data_.key_code; |
72 } | 92 } |
73 | 93 |
74 PP_Var InputEventImpl::GetCharacterText() { | 94 PP_Var InputEventImpl::GetCharacterText() { |
75 return StringToPPVar(data_.character_text); | 95 return StringVar::StringToPPVar( |
| 96 TrackerBase::Get()->GetModuleForInstance(pp_instance()), |
| 97 data_.character_text); |
76 } | 98 } |
77 | 99 |
78 } // namespace ppapi | 100 } // namespace ppapi |
79 | 101 |
OLD | NEW |