| 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 #ifndef PPAPI_SHARED_IMPL_PPB_INPUT_EVENT_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPB_INPUT_EVENT_SHARED_H_ |
| 6 #define PPAPI_SHARED_IMPL_PPB_INPUT_EVENT_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_PPB_INPUT_EVENT_SHARED_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "ppapi/c/ppb_input_event.h" |
| 13 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
| 14 #include "ppapi/thunk/ppb_input_event_api.h" | 15 #include "ppapi/thunk/ppb_input_event_api.h" |
| 15 | 16 |
| 16 namespace ppapi { | 17 namespace ppapi { |
| 17 | 18 |
| 18 // IF YOU ADD STUFF TO THIS CLASS | 19 // IF YOU ADD STUFF TO THIS CLASS |
| 19 // ============================== | 20 // ============================== |
| 20 // Be sure to add it to the STRUCT_TRAITS at the top of ppapi_messages.h | 21 // Be sure to add it to the STRUCT_TRAITS at the top of ppapi_messages.h |
| 21 struct PPAPI_SHARED_EXPORT InputEventData { | 22 struct PPAPI_SHARED_EXPORT InputEventData { |
| 22 InputEventData(); | 23 InputEventData(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 | 42 |
| 42 uint32_t key_code; | 43 uint32_t key_code; |
| 43 uint32_t usb_key_code; | 44 uint32_t usb_key_code; |
| 44 | 45 |
| 45 std::string character_text; | 46 std::string character_text; |
| 46 | 47 |
| 47 std::vector<uint32_t> composition_segment_offsets; | 48 std::vector<uint32_t> composition_segment_offsets; |
| 48 int32_t composition_target_segment; | 49 int32_t composition_target_segment; |
| 49 uint32_t composition_selection_start; | 50 uint32_t composition_selection_start; |
| 50 uint32_t composition_selection_end; | 51 uint32_t composition_selection_end; |
| 52 |
| 53 std::vector<PP_TouchPoint> touches; |
| 54 std::vector<PP_TouchPoint> changed_touches; |
| 55 std::vector<PP_TouchPoint> target_touches; |
| 51 }; | 56 }; |
| 52 | 57 |
| 53 // This simple class implements the PPB_InputEvent_API in terms of the | 58 // This simple class implements the PPB_InputEvent_API in terms of the |
| 54 // shared InputEventData structure | 59 // shared InputEventData structure |
| 55 class PPAPI_SHARED_EXPORT PPB_InputEvent_Shared | 60 class PPAPI_SHARED_EXPORT PPB_InputEvent_Shared |
| 56 : public Resource, | 61 : public Resource, |
| 57 public thunk::PPB_InputEvent_API { | 62 public thunk::PPB_InputEvent_API { |
| 58 public: | 63 public: |
| 59 PPB_InputEvent_Shared(ResourceObjectType type, | 64 PPB_InputEvent_Shared(ResourceObjectType type, |
| 60 PP_Instance instance, | 65 PP_Instance instance, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 76 virtual PP_FloatPoint GetWheelTicks() OVERRIDE; | 81 virtual PP_FloatPoint GetWheelTicks() OVERRIDE; |
| 77 virtual PP_Bool GetWheelScrollByPage() OVERRIDE; | 82 virtual PP_Bool GetWheelScrollByPage() OVERRIDE; |
| 78 virtual uint32_t GetKeyCode() OVERRIDE; | 83 virtual uint32_t GetKeyCode() OVERRIDE; |
| 79 virtual PP_Var GetCharacterText() OVERRIDE; | 84 virtual PP_Var GetCharacterText() OVERRIDE; |
| 80 virtual PP_Bool SetUsbKeyCode(uint32_t usb_key_code) OVERRIDE; | 85 virtual PP_Bool SetUsbKeyCode(uint32_t usb_key_code) OVERRIDE; |
| 81 virtual uint32_t GetUsbKeyCode() OVERRIDE; | 86 virtual uint32_t GetUsbKeyCode() OVERRIDE; |
| 82 virtual uint32_t GetIMESegmentNumber() OVERRIDE; | 87 virtual uint32_t GetIMESegmentNumber() OVERRIDE; |
| 83 virtual uint32_t GetIMESegmentOffset(uint32_t index) OVERRIDE; | 88 virtual uint32_t GetIMESegmentOffset(uint32_t index) OVERRIDE; |
| 84 virtual int32_t GetIMETargetSegment() OVERRIDE; | 89 virtual int32_t GetIMETargetSegment() OVERRIDE; |
| 85 virtual void GetIMESelection(uint32_t* start, uint32_t* end) OVERRIDE; | 90 virtual void GetIMESelection(uint32_t* start, uint32_t* end) OVERRIDE; |
| 91 virtual void AddTouchPoint(PP_TouchListType list, |
| 92 const PP_TouchPoint& point) OVERRIDE; |
| 93 virtual uint32_t GetTouchCount(PP_TouchListType list) OVERRIDE; |
| 94 virtual PP_TouchPoint GetTouchByIndex(PP_TouchListType list, |
| 95 uint32_t index) OVERRIDE; |
| 96 virtual PP_TouchPoint GetTouchById(PP_TouchListType list, |
| 97 uint32_t id) OVERRIDE; |
| 86 | 98 |
| 87 // Implementations for event creation. | 99 // Implementations for event creation. |
| 88 static PP_Resource CreateIMEInputEvent(ResourceObjectType type, | 100 static PP_Resource CreateIMEInputEvent(ResourceObjectType type, |
| 89 PP_Instance instance, | 101 PP_Instance instance, |
| 90 PP_InputEvent_Type event_type, | 102 PP_InputEvent_Type event_type, |
| 91 PP_TimeTicks time_stamp, | 103 PP_TimeTicks time_stamp, |
| 92 struct PP_Var text, | 104 struct PP_Var text, |
| 93 uint32_t segment_number, | 105 uint32_t segment_number, |
| 94 const uint32_t* segment_offsets, | 106 const uint32_t* segment_offsets, |
| 95 int32_t target_segment, | 107 int32_t target_segment, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 122 | 134 |
| 123 private: | 135 private: |
| 124 InputEventData data_; | 136 InputEventData data_; |
| 125 | 137 |
| 126 DISALLOW_IMPLICIT_CONSTRUCTORS(PPB_InputEvent_Shared); | 138 DISALLOW_IMPLICIT_CONSTRUCTORS(PPB_InputEvent_Shared); |
| 127 }; | 139 }; |
| 128 | 140 |
| 129 } // namespace ppapi | 141 } // namespace ppapi |
| 130 | 142 |
| 131 #endif // PPAPI_SHARED_IMPL_PPB_INPUT_EVENT_SHARED_H_ | 143 #endif // PPAPI_SHARED_IMPL_PPB_INPUT_EVENT_SHARED_H_ |
| OLD | NEW |