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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "ppapi/c/ppb_input_event.h" | 15 #include "ppapi/c/ppb_input_event.h" |
16 #include "ppapi/shared_impl/resource.h" | 16 #include "ppapi/shared_impl/resource.h" |
17 #include "ppapi/thunk/ppb_input_event_api.h" | 17 #include "ppapi/thunk/ppb_input_event_api.h" |
18 | 18 |
19 namespace ppapi { | 19 namespace ppapi { |
20 | 20 |
| 21 struct TouchPointWithTilt { |
| 22 PP_TouchPoint touch; |
| 23 PP_FloatPoint tilt; |
| 24 }; |
| 25 |
21 // IF YOU ADD STUFF TO THIS CLASS | 26 // IF YOU ADD STUFF TO THIS CLASS |
22 // ============================== | 27 // ============================== |
23 // Be sure to add it to the STRUCT_TRAITS at the top of ppapi_messages.h | 28 // Be sure to add it to the STRUCT_TRAITS at the top of ppapi_messages.h |
24 struct PPAPI_SHARED_EXPORT InputEventData { | 29 struct PPAPI_SHARED_EXPORT InputEventData { |
25 InputEventData(); | 30 InputEventData(); |
26 ~InputEventData(); | 31 ~InputEventData(); |
27 | 32 |
28 // Internal-only value. Set to true when this input event is filtered, that | 33 // Internal-only value. Set to true when this input event is filtered, that |
29 // is, should be delivered synchronously. This is used by the proxy. | 34 // is, should be delivered synchronously. This is used by the proxy. |
30 bool is_filtered; | 35 bool is_filtered; |
(...skipping 17 matching lines...) Expand all Loading... |
48 // http://www.w3.org/TR/uievents/ | 53 // http://www.w3.org/TR/uievents/ |
49 std::string code; | 54 std::string code; |
50 | 55 |
51 std::string character_text; | 56 std::string character_text; |
52 | 57 |
53 std::vector<uint32_t> composition_segment_offsets; | 58 std::vector<uint32_t> composition_segment_offsets; |
54 int32_t composition_target_segment; | 59 int32_t composition_target_segment; |
55 uint32_t composition_selection_start; | 60 uint32_t composition_selection_start; |
56 uint32_t composition_selection_end; | 61 uint32_t composition_selection_end; |
57 | 62 |
58 std::vector<PP_TouchPoint> touches; | 63 std::vector<TouchPointWithTilt> touches; |
59 std::vector<PP_TouchPoint> changed_touches; | 64 std::vector<TouchPointWithTilt> changed_touches; |
60 std::vector<PP_TouchPoint> target_touches; | 65 std::vector<TouchPointWithTilt> target_touches; |
61 }; | 66 }; |
62 | 67 |
63 // This simple class implements the PPB_InputEvent_API in terms of the | 68 // This simple class implements the PPB_InputEvent_API in terms of the |
64 // shared InputEventData structure | 69 // shared InputEventData structure |
65 class PPAPI_SHARED_EXPORT PPB_InputEvent_Shared | 70 class PPAPI_SHARED_EXPORT PPB_InputEvent_Shared |
66 : public Resource, | 71 : public Resource, |
67 public thunk::PPB_InputEvent_API { | 72 public thunk::PPB_InputEvent_API { |
68 public: | 73 public: |
69 PPB_InputEvent_Shared(ResourceObjectType type, | 74 PPB_InputEvent_Shared(ResourceObjectType type, |
70 PP_Instance instance, | 75 PP_Instance instance, |
(...skipping 19 matching lines...) Expand all Loading... |
90 PP_Var GetCode() override; | 95 PP_Var GetCode() override; |
91 uint32_t GetIMESegmentNumber() override; | 96 uint32_t GetIMESegmentNumber() override; |
92 uint32_t GetIMESegmentOffset(uint32_t index) override; | 97 uint32_t GetIMESegmentOffset(uint32_t index) override; |
93 int32_t GetIMETargetSegment() override; | 98 int32_t GetIMETargetSegment() override; |
94 void GetIMESelection(uint32_t* start, uint32_t* end) override; | 99 void GetIMESelection(uint32_t* start, uint32_t* end) override; |
95 void AddTouchPoint(PP_TouchListType list, | 100 void AddTouchPoint(PP_TouchListType list, |
96 const PP_TouchPoint& point) override; | 101 const PP_TouchPoint& point) override; |
97 uint32_t GetTouchCount(PP_TouchListType list) override; | 102 uint32_t GetTouchCount(PP_TouchListType list) override; |
98 PP_TouchPoint GetTouchByIndex(PP_TouchListType list, uint32_t index) override; | 103 PP_TouchPoint GetTouchByIndex(PP_TouchListType list, uint32_t index) override; |
99 PP_TouchPoint GetTouchById(PP_TouchListType list, uint32_t id) override; | 104 PP_TouchPoint GetTouchById(PP_TouchListType list, uint32_t id) override; |
| 105 PP_FloatPoint GetTouchTiltByIndex(PP_TouchListType list, |
| 106 uint32_t index) override; |
| 107 PP_FloatPoint GetTouchTiltById(PP_TouchListType list, uint32_t id) override; |
100 | 108 |
101 // Implementations for event creation. | 109 // Implementations for event creation. |
102 static PP_Resource CreateIMEInputEvent(ResourceObjectType type, | 110 static PP_Resource CreateIMEInputEvent(ResourceObjectType type, |
103 PP_Instance instance, | 111 PP_Instance instance, |
104 PP_InputEvent_Type event_type, | 112 PP_InputEvent_Type event_type, |
105 PP_TimeTicks time_stamp, | 113 PP_TimeTicks time_stamp, |
106 struct PP_Var text, | 114 struct PP_Var text, |
107 uint32_t segment_number, | 115 uint32_t segment_number, |
108 const uint32_t* segment_offsets, | 116 const uint32_t* segment_offsets, |
109 int32_t target_segment, | 117 int32_t target_segment, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 150 |
143 private: | 151 private: |
144 InputEventData data_; | 152 InputEventData data_; |
145 | 153 |
146 DISALLOW_IMPLICIT_CONSTRUCTORS(PPB_InputEvent_Shared); | 154 DISALLOW_IMPLICIT_CONSTRUCTORS(PPB_InputEvent_Shared); |
147 }; | 155 }; |
148 | 156 |
149 } // namespace ppapi | 157 } // namespace ppapi |
150 | 158 |
151 #endif // PPAPI_SHARED_IMPL_PPB_INPUT_EVENT_SHARED_H_ | 159 #endif // PPAPI_SHARED_IMPL_PPB_INPUT_EVENT_SHARED_H_ |
OLD | NEW |