| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 104   return PP_TRUE; | 104   return PP_TRUE; | 
| 105 } | 105 } | 
| 106 | 106 | 
| 107 uint32_t PPB_InputEvent_Shared::GetUsbKeyCode() { | 107 uint32_t PPB_InputEvent_Shared::GetUsbKeyCode() { | 
| 108   return data_.usb_key_code; | 108   return data_.usb_key_code; | 
| 109 } | 109 } | 
| 110 | 110 | 
| 111 uint32_t PPB_InputEvent_Shared::GetIMESegmentNumber() { | 111 uint32_t PPB_InputEvent_Shared::GetIMESegmentNumber() { | 
| 112   if (data_.composition_segment_offsets.empty()) | 112   if (data_.composition_segment_offsets.empty()) | 
| 113     return 0; | 113     return 0; | 
| 114   return data_.composition_segment_offsets.size() - 1; | 114   return static_cast<uint32_t>(data_.composition_segment_offsets.size() - 1); | 
| 115 } | 115 } | 
| 116 | 116 | 
| 117 uint32_t PPB_InputEvent_Shared::GetIMESegmentOffset(uint32_t index) { | 117 uint32_t PPB_InputEvent_Shared::GetIMESegmentOffset(uint32_t index) { | 
| 118   if (index >= data_.composition_segment_offsets.size()) | 118   if (index >= data_.composition_segment_offsets.size()) | 
| 119     return 0; | 119     return 0; | 
| 120   return data_.composition_segment_offsets[index]; | 120   return data_.composition_segment_offsets[index]; | 
| 121 } | 121 } | 
| 122 | 122 | 
| 123 int32_t PPB_InputEvent_Shared::GetIMETargetSegment() { | 123 int32_t PPB_InputEvent_Shared::GetIMETargetSegment() { | 
| 124   return data_.composition_target_segment; | 124   return data_.composition_target_segment; | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 144       data_.target_touches.push_back(point); | 144       data_.target_touches.push_back(point); | 
| 145       break; | 145       break; | 
| 146     default: | 146     default: | 
| 147       break; | 147       break; | 
| 148   } | 148   } | 
| 149 } | 149 } | 
| 150 | 150 | 
| 151 uint32_t PPB_InputEvent_Shared::GetTouchCount(PP_TouchListType list) { | 151 uint32_t PPB_InputEvent_Shared::GetTouchCount(PP_TouchListType list) { | 
| 152   switch (list) { | 152   switch (list) { | 
| 153     case PP_TOUCHLIST_TYPE_TOUCHES: | 153     case PP_TOUCHLIST_TYPE_TOUCHES: | 
| 154       return data_.touches.size(); | 154       return static_cast<uint32_t>(data_.touches.size()); | 
| 155     case PP_TOUCHLIST_TYPE_CHANGEDTOUCHES: | 155     case PP_TOUCHLIST_TYPE_CHANGEDTOUCHES: | 
| 156       return data_.changed_touches.size(); | 156       return static_cast<uint32_t>(data_.changed_touches.size()); | 
| 157     case PP_TOUCHLIST_TYPE_TARGETTOUCHES: | 157     case PP_TOUCHLIST_TYPE_TARGETTOUCHES: | 
| 158       return data_.target_touches.size(); | 158       return static_cast<uint32_t>(data_.target_touches.size()); | 
| 159   } | 159   } | 
| 160 | 160 | 
| 161   return 0; | 161   return 0; | 
| 162 } | 162 } | 
| 163 | 163 | 
| 164 PP_TouchPoint PPB_InputEvent_Shared::GetTouchByIndex(PP_TouchListType list, | 164 PP_TouchPoint PPB_InputEvent_Shared::GetTouchByIndex(PP_TouchListType list, | 
| 165                                                      uint32_t index) { | 165                                                      uint32_t index) { | 
| 166   std::vector<PP_TouchPoint>* points; | 166   std::vector<PP_TouchPoint>* points; | 
| 167   switch (list) { | 167   switch (list) { | 
| 168     case PP_TOUCHLIST_TYPE_TOUCHES: | 168     case PP_TOUCHLIST_TYPE_TOUCHES: | 
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 338     return 0; | 338     return 0; | 
| 339 | 339 | 
| 340   InputEventData data; | 340   InputEventData data; | 
| 341   data.event_type = event_type; | 341   data.event_type = event_type; | 
| 342   data.event_time_stamp = time_stamp; | 342   data.event_time_stamp = time_stamp; | 
| 343   data.event_modifiers = modifiers; | 343   data.event_modifiers = modifiers; | 
| 344   return (new PPB_InputEvent_Shared(type, instance, data))->GetReference(); | 344   return (new PPB_InputEvent_Shared(type, instance, data))->GetReference(); | 
| 345 } | 345 } | 
| 346 | 346 | 
| 347 }  // namespace ppapi | 347 }  // namespace ppapi | 
| OLD | NEW | 
|---|