| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ppb_input_event_shared.h" | 5 #include "ppapi/shared_impl/ppb_input_event_shared.h" |
| 6 | 6 |
| 7 #include "ppapi/shared_impl/var.h" | 7 #include "ppapi/shared_impl/var.h" |
| 8 | 8 |
| 9 using ppapi::thunk::PPB_InputEvent_API; | 9 using ppapi::thunk::PPB_InputEvent_API; |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 uint32_t PPB_InputEvent_Shared::GetKeyCode() { | 90 uint32_t PPB_InputEvent_Shared::GetKeyCode() { |
| 91 return data_.key_code; | 91 return data_.key_code; |
| 92 } | 92 } |
| 93 | 93 |
| 94 PP_Var PPB_InputEvent_Shared::GetCharacterText() { | 94 PP_Var PPB_InputEvent_Shared::GetCharacterText() { |
| 95 return StringVar::StringToPPVar(data_.character_text); | 95 return StringVar::StringToPPVar(data_.character_text); |
| 96 } | 96 } |
| 97 | 97 |
| 98 PP_Bool PPB_InputEvent_Shared::SetUsbKeyCode(uint32_t usb_key_code) { |
| 99 data_.usb_key_code = usb_key_code; |
| 100 return PP_TRUE; |
| 101 } |
| 102 |
| 103 uint32_t PPB_InputEvent_Shared::GetUsbKeyCode() { |
| 104 return data_.usb_key_code; |
| 105 } |
| 106 |
| 98 uint32_t PPB_InputEvent_Shared::GetIMESegmentNumber() { | 107 uint32_t PPB_InputEvent_Shared::GetIMESegmentNumber() { |
| 99 if (data_.composition_segment_offsets.empty()) | 108 if (data_.composition_segment_offsets.empty()) |
| 100 return 0; | 109 return 0; |
| 101 return data_.composition_segment_offsets.size() - 1; | 110 return data_.composition_segment_offsets.size() - 1; |
| 102 } | 111 } |
| 103 | 112 |
| 104 uint32_t PPB_InputEvent_Shared::GetIMESegmentOffset(uint32_t index) { | 113 uint32_t PPB_InputEvent_Shared::GetIMESegmentOffset(uint32_t index) { |
| 105 if (index >= data_.composition_segment_offsets.size()) | 114 if (index >= data_.composition_segment_offsets.size()) |
| 106 return 0; | 115 return 0; |
| 107 return data_.composition_segment_offsets[index]; | 116 return data_.composition_segment_offsets[index]; |
| 108 } | 117 } |
| 109 | 118 |
| 110 int32_t PPB_InputEvent_Shared::GetIMETargetSegment() { | 119 int32_t PPB_InputEvent_Shared::GetIMETargetSegment() { |
| 111 return data_.composition_target_segment; | 120 return data_.composition_target_segment; |
| 112 } | 121 } |
| 113 | 122 |
| 114 void PPB_InputEvent_Shared::GetIMESelection(uint32_t* start, uint32_t* end) { | 123 void PPB_InputEvent_Shared::GetIMESelection(uint32_t* start, uint32_t* end) { |
| 115 if (start) | 124 if (start) |
| 116 *start = data_.composition_selection_start; | 125 *start = data_.composition_selection_start; |
| 117 if (end) | 126 if (end) |
| 118 *end = data_.composition_selection_end; | 127 *end = data_.composition_selection_end; |
| 119 } | 128 } |
| 120 | 129 |
| 121 } // namespace ppapi | 130 } // namespace ppapi |
| OLD | NEW |