Chromium Code Reviews| 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(), | |
| 
 
yzshen1
2011/09/22 19:24:00
nit: You don't need this.
 
kinaba
2011/09/27 02:49:27
Done.
 
 | |
| 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 uint32_t InputEventImpl::GetIMESegmentNumber() { | |
| 110 if (data_.composition_segments.empty()) | |
| 111 return 0; | |
| 112 return data_.composition_segments.size() - 1; | |
| 113 } | |
| 114 | |
| 115 uint32_t InputEventImpl::GetIMESegmentOffset(uint32_t index) { | |
| 116 if (index >= data_.composition_segments.size()) | |
| 117 return 0; | |
| 118 return data_.composition_segments[index]; | |
| 119 } | |
| 120 | |
| 121 int32_t InputEventImpl::GetIMETargetSegment() { | |
| 122 return data_.composition_target_segment; | |
| 123 } | |
| 124 | |
| 125 void InputEventImpl::GetIMESelection(uint32_t* start, uint32_t* end) { | |
| 126 if (start) | |
| 127 *start = data_.composition_selection_start; | |
| 128 if (end) | |
| 129 *end = data_.composition_selection_end; | |
| 130 } | |
| 131 | |
| 105 } // namespace ppapi | 132 } // namespace ppapi | 
| 106 | |
| OLD | NEW |