| 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_target_segment(-1), | 
 |   29       composition_selection_start(0), | 
 |   30       composition_selection_end(0) { | 
|   28 } |   31 } | 
|   29  |   32  | 
|   30 InputEventData::~InputEventData() { |   33 InputEventData::~InputEventData() { | 
|   31 } |   34 } | 
|   32  |   35  | 
|   33 InputEventImpl::InputEventImpl(const InitAsImpl&, |   36 InputEventImpl::InputEventImpl(const InitAsImpl&, | 
|   34                                PP_Instance instance, |   37                                PP_Instance instance, | 
|   35                                const InputEventData& data) |   38                                const InputEventData& data) | 
|   36     : Resource(instance), |   39     : Resource(instance), | 
|   37       data_(data) { |   40       data_(data) { | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   95 uint32_t InputEventImpl::GetKeyCode() { |   98 uint32_t InputEventImpl::GetKeyCode() { | 
|   96   return data_.key_code; |   99   return data_.key_code; | 
|   97 } |  100 } | 
|   98  |  101  | 
|   99 PP_Var InputEventImpl::GetCharacterText() { |  102 PP_Var InputEventImpl::GetCharacterText() { | 
|  100   return StringVar::StringToPPVar( |  103   return StringVar::StringToPPVar( | 
|  101       TrackerBase::Get()->GetModuleForInstance(pp_instance()), |  104       TrackerBase::Get()->GetModuleForInstance(pp_instance()), | 
|  102       data_.character_text); |  105       data_.character_text); | 
|  103 } |  106 } | 
|  104  |  107  | 
 |  108 uint32_t InputEventImpl::GetIMESegmentNumber() { | 
 |  109   if (data_.composition_segment_offsets.empty()) | 
 |  110     return 0; | 
 |  111   return data_.composition_segment_offsets.size() - 1; | 
 |  112 } | 
 |  113  | 
 |  114 uint32_t InputEventImpl::GetIMESegmentOffset(uint32_t index) { | 
 |  115   if (index >= data_.composition_segment_offsets.size()) | 
 |  116     return 0; | 
 |  117   return data_.composition_segment_offsets[index]; | 
 |  118 } | 
 |  119  | 
 |  120 int32_t InputEventImpl::GetIMETargetSegment() { | 
 |  121   return data_.composition_target_segment; | 
 |  122 } | 
 |  123  | 
 |  124 void InputEventImpl::GetIMESelection(uint32_t* start, uint32_t* end) { | 
 |  125   if (start) | 
 |  126     *start = data_.composition_selection_start; | 
 |  127   if (end) | 
 |  128     *end = data_.composition_selection_end; | 
 |  129 } | 
 |  130  | 
|  105 }  // namespace ppapi |  131 }  // namespace ppapi | 
|  106  |  | 
| OLD | NEW |