OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ |
7 | 7 |
8 #include <array> | |
8 #include "base/macros.h" | 9 #include "base/macros.h" |
9 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 10 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
10 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 11 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
11 #include "content/browser/renderer_host/input/synthetic_pointer.h" | 12 #include "content/browser/renderer_host/input/synthetic_pointer.h" |
12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
13 #include "content/common/input/synthetic_pointer_action_params.h" | 14 #include "content/common/input/synthetic_pointer_action_params.h" |
14 | 15 |
16 using blink::WebTouchEvent; | |
17 | |
15 namespace content { | 18 namespace content { |
16 | 19 |
17 class CONTENT_EXPORT SyntheticPointerAction : public SyntheticGesture { | 20 class CONTENT_EXPORT SyntheticPointerAction : public SyntheticGesture { |
18 public: | 21 public: |
22 using IndexMap = std::array<int, WebTouchEvent::touchesLengthCap>; | |
23 | |
19 explicit SyntheticPointerAction(const SyntheticPointerActionParams& params); | 24 explicit SyntheticPointerAction(const SyntheticPointerActionParams& params); |
20 SyntheticPointerAction(const SyntheticPointerActionParams& params, | 25 SyntheticPointerAction( |
21 SyntheticPointer* synthetic_pointer); | 26 std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list, |
27 SyntheticPointer* synthetic_pointer, | |
28 IndexMap* index_map); | |
22 ~SyntheticPointerAction() override; | 29 ~SyntheticPointerAction() override; |
23 | 30 |
24 SyntheticGesture::Result ForwardInputEvents( | 31 SyntheticGesture::Result ForwardInputEvents( |
25 const base::TimeTicks& timestamp, | 32 const base::TimeTicks& timestamp, |
26 SyntheticGestureTarget* target) override; | 33 SyntheticGestureTarget* target) override; |
27 | 34 |
28 void ForwardTouchOrMouseInputEvents(const base::TimeTicks& timestamp, | 35 private: |
29 SyntheticGestureTarget* target); | 36 SyntheticGesture::Result ForwardTouchOrMouseInputEvents( |
37 const base::TimeTicks& timestamp, | |
38 SyntheticGestureTarget* target); | |
39 int GetPointIndex(int index) const { return (*index_map_)[index]; } | |
40 void SetPointIndex(int index, int point_index) { | |
41 (*index_map_)[index] = point_index; | |
42 } | |
43 bool UserInputCheck(const SyntheticPointerActionParams& params); | |
tdresser
2016/06/28 15:44:11
Let's add a comment here explaining what UserInput
lanwei
2016/07/07 19:35:31
Maybe not, this function will just return true or
| |
30 | 44 |
31 private: | 45 // SyntheticGestureController is responsible to create the |
46 // SyntheticPointerActions and control when to forward them. | |
47 // This will be passed from SyntheticGestureController, which will reset its | |
48 // value to push a new batch of action parameters. | |
49 // This contains a list of pointer actions which will be dispatched together. | |
50 const std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list_; | |
51 // These two objects will be owned by SyntheticGestureController, which | |
52 // will manage their lifetime by initiating them when it starts processing a | |
53 // pointer action sequence and resetting them when it finishes. | |
54 SyntheticPointer* synthetic_pointer_; | |
55 IndexMap* index_map_; | |
56 | |
32 SyntheticPointerActionParams params_; | 57 SyntheticPointerActionParams params_; |
33 SyntheticPointer* synthetic_pointer_; | |
34 | 58 |
35 DISALLOW_COPY_AND_ASSIGN(SyntheticPointerAction); | 59 DISALLOW_COPY_AND_ASSIGN(SyntheticPointerAction); |
36 }; | 60 }; |
37 | 61 |
38 } // namespace content | 62 } // namespace content |
39 | 63 |
40 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ | 64 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ |
OLD | NEW |