| 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/ppapi_globals.h" | |
| 8 #include "ppapi/shared_impl/var.h" | 7 #include "ppapi/shared_impl/var.h" |
| 9 | 8 |
| 10 using ppapi::thunk::PPB_InputEvent_API; | 9 using ppapi::thunk::PPB_InputEvent_API; |
| 11 | 10 |
| 12 namespace ppapi { | 11 namespace ppapi { |
| 13 | 12 |
| 14 InputEventData::InputEventData() | 13 InputEventData::InputEventData() |
| 15 : is_filtered(false), | 14 : is_filtered(false), |
| 16 event_type(PP_INPUTEVENT_TYPE_UNDEFINED), | 15 event_type(PP_INPUTEVENT_TYPE_UNDEFINED), |
| 17 event_time_stamp(0.0), | 16 event_time_stamp(0.0), |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 92 |
| 94 PP_Bool InputEventImpl::GetWheelScrollByPage() { | 93 PP_Bool InputEventImpl::GetWheelScrollByPage() { |
| 95 return PP_FromBool(data_.wheel_scroll_by_page); | 94 return PP_FromBool(data_.wheel_scroll_by_page); |
| 96 } | 95 } |
| 97 | 96 |
| 98 uint32_t InputEventImpl::GetKeyCode() { | 97 uint32_t InputEventImpl::GetKeyCode() { |
| 99 return data_.key_code; | 98 return data_.key_code; |
| 100 } | 99 } |
| 101 | 100 |
| 102 PP_Var InputEventImpl::GetCharacterText() { | 101 PP_Var InputEventImpl::GetCharacterText() { |
| 103 return StringVar::StringToPPVar( | 102 return StringVar::StringToPPVar(data_.character_text); |
| 104 PpapiGlobals::Get()->GetModuleForInstance(pp_instance()), | |
| 105 data_.character_text); | |
| 106 } | 103 } |
| 107 | 104 |
| 108 uint32_t InputEventImpl::GetIMESegmentNumber() { | 105 uint32_t InputEventImpl::GetIMESegmentNumber() { |
| 109 if (data_.composition_segment_offsets.empty()) | 106 if (data_.composition_segment_offsets.empty()) |
| 110 return 0; | 107 return 0; |
| 111 return data_.composition_segment_offsets.size() - 1; | 108 return data_.composition_segment_offsets.size() - 1; |
| 112 } | 109 } |
| 113 | 110 |
| 114 uint32_t InputEventImpl::GetIMESegmentOffset(uint32_t index) { | 111 uint32_t InputEventImpl::GetIMESegmentOffset(uint32_t index) { |
| 115 if (index >= data_.composition_segment_offsets.size()) | 112 if (index >= data_.composition_segment_offsets.size()) |
| 116 return 0; | 113 return 0; |
| 117 return data_.composition_segment_offsets[index]; | 114 return data_.composition_segment_offsets[index]; |
| 118 } | 115 } |
| 119 | 116 |
| 120 int32_t InputEventImpl::GetIMETargetSegment() { | 117 int32_t InputEventImpl::GetIMETargetSegment() { |
| 121 return data_.composition_target_segment; | 118 return data_.composition_target_segment; |
| 122 } | 119 } |
| 123 | 120 |
| 124 void InputEventImpl::GetIMESelection(uint32_t* start, uint32_t* end) { | 121 void InputEventImpl::GetIMESelection(uint32_t* start, uint32_t* end) { |
| 125 if (start) | 122 if (start) |
| 126 *start = data_.composition_selection_start; | 123 *start = data_.composition_selection_start; |
| 127 if (end) | 124 if (end) |
| 128 *end = data_.composition_selection_end; | 125 *end = data_.composition_selection_end; |
| 129 } | 126 } |
| 130 | 127 |
| 131 } // namespace ppapi | 128 } // namespace ppapi |
| OLD | NEW |