| 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 mouse_movement(PP_MakePoint(0, 0)), |
| 23 wheel_delta(PP_MakeFloatPoint(0.0f, 0.0f)), | 23 wheel_delta(PP_MakeFloatPoint(0.0f, 0.0f)), |
| 24 wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)), | 24 wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)), |
| 25 wheel_scroll_by_page(false), | 25 wheel_scroll_by_page(false), |
| 26 key_code(0), | 26 key_code(0), |
| 27 character_text() { | 27 character_text(), |
| 28 composition_segments(), |
| 29 composition_target_segment(-1), |
| 30 composition_selection_start(0), |
| 31 composition_selection_end(0) { |
| 28 } | 32 } |
| 29 | 33 |
| 30 InputEventData::~InputEventData() { | 34 InputEventData::~InputEventData() { |
| 31 } | 35 } |
| 32 | 36 |
| 33 InputEventImpl::InputEventImpl(const InitAsImpl&, | 37 InputEventImpl::InputEventImpl(const InitAsImpl&, |
| 34 PP_Instance instance, | 38 PP_Instance instance, |
| 35 const InputEventData& data) | 39 const InputEventData& data) |
| 36 : Resource(instance), | 40 : Resource(instance), |
| 37 data_(data) { | 41 data_(data) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 uint32_t InputEventImpl::GetKeyCode() { | 99 uint32_t InputEventImpl::GetKeyCode() { |
| 96 return data_.key_code; | 100 return data_.key_code; |
| 97 } | 101 } |
| 98 | 102 |
| 99 PP_Var InputEventImpl::GetCharacterText() { | 103 PP_Var InputEventImpl::GetCharacterText() { |
| 100 return StringVar::StringToPPVar( | 104 return StringVar::StringToPPVar( |
| 101 TrackerBase::Get()->GetModuleForInstance(pp_instance()), | 105 TrackerBase::Get()->GetModuleForInstance(pp_instance()), |
| 102 data_.character_text); | 106 data_.character_text); |
| 103 } | 107 } |
| 104 | 108 |
| 109 void InputEventImpl::GetCompositionSegments(uint32_t** segs, uint32_t* size) { |
| 110 if (segs) |
| 111 *segs = data_.composition_segments.data(); |
| 112 if (size) |
| 113 *size = data_.composition_segments.size() / 2; |
| 114 } |
| 115 |
| 116 int32_t InputEventImpl::GetCompositionTargetSegment() { |
| 117 return data_.composition_target_segment; |
| 118 } |
| 119 |
| 120 void InputEventImpl::GetCompositionSelection(uint32_t* start, uint32_t* end) { |
| 121 if (start) |
| 122 *start = data_.composition_selection_start; |
| 123 if (end) |
| 124 *end = data_.composition_selection_end; |
| 125 } |
| 126 |
| 105 } // namespace ppapi | 127 } // namespace ppapi |
| 106 | 128 |
| OLD | NEW |