| 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/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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 uint32_t PPB_InputEvent_Shared::GetKeyCode() { | 97 uint32_t PPB_InputEvent_Shared::GetKeyCode() { |
| 98 return data_.key_code; | 98 return data_.key_code; |
| 99 } | 99 } |
| 100 | 100 |
| 101 PP_Var PPB_InputEvent_Shared::GetCharacterText() { | 101 PP_Var PPB_InputEvent_Shared::GetCharacterText() { |
| 102 return StringVar::StringToPPVar(data_.character_text); | 102 return StringVar::StringToPPVar(data_.character_text); |
| 103 } | 103 } |
| 104 | 104 |
| 105 PP_Bool PPB_InputEvent_Shared::SetUsbScanCode(uint32_t usb_scan_code) { |
| 106 data_.usb_scan_code = usb_scan_code; |
| 107 return PP_TRUE; |
| 108 } |
| 109 |
| 110 uint32_t PPB_InputEvent_Shared::GetUsbScanCode() { |
| 111 return data_.usb_scan_code; |
| 112 } |
| 113 |
| 105 uint32_t PPB_InputEvent_Shared::GetIMESegmentNumber() { | 114 uint32_t PPB_InputEvent_Shared::GetIMESegmentNumber() { |
| 106 if (data_.composition_segment_offsets.empty()) | 115 if (data_.composition_segment_offsets.empty()) |
| 107 return 0; | 116 return 0; |
| 108 return data_.composition_segment_offsets.size() - 1; | 117 return data_.composition_segment_offsets.size() - 1; |
| 109 } | 118 } |
| 110 | 119 |
| 111 uint32_t PPB_InputEvent_Shared::GetIMESegmentOffset(uint32_t index) { | 120 uint32_t PPB_InputEvent_Shared::GetIMESegmentOffset(uint32_t index) { |
| 112 if (index >= data_.composition_segment_offsets.size()) | 121 if (index >= data_.composition_segment_offsets.size()) |
| 113 return 0; | 122 return 0; |
| 114 return data_.composition_segment_offsets[index]; | 123 return data_.composition_segment_offsets[index]; |
| 115 } | 124 } |
| 116 | 125 |
| 117 int32_t PPB_InputEvent_Shared::GetIMETargetSegment() { | 126 int32_t PPB_InputEvent_Shared::GetIMETargetSegment() { |
| 118 return data_.composition_target_segment; | 127 return data_.composition_target_segment; |
| 119 } | 128 } |
| 120 | 129 |
| 121 void PPB_InputEvent_Shared::GetIMESelection(uint32_t* start, uint32_t* end) { | 130 void PPB_InputEvent_Shared::GetIMESelection(uint32_t* start, uint32_t* end) { |
| 122 if (start) | 131 if (start) |
| 123 *start = data_.composition_selection_start; | 132 *start = data_.composition_selection_start; |
| 124 if (end) | 133 if (end) |
| 125 *end = data_.composition_selection_end; | 134 *end = data_.composition_selection_end; |
| 126 } | 135 } |
| 127 | 136 |
| 128 } // namespace ppapi | 137 } // namespace ppapi |
| OLD | NEW |