Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: content/browser/renderer_host/input/synthetic_pointer_action.h

Issue 1884883005: Prepare SyntheticPointerAction to handle touch actions for multiple fingers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: return nullptr Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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:
19 explicit SyntheticPointerAction(const SyntheticPointerActionParams& params); 22 using IndexMap = std::array<int, WebTouchEvent::touchesLengthCap>;
20 SyntheticPointerAction(const SyntheticPointerActionParams& params, 23
21 SyntheticPointer* synthetic_pointer); 24 SyntheticPointerAction(
25 std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list,
26 SyntheticPointer* synthetic_pointer,
27 IndexMap* index_map);
22 ~SyntheticPointerAction() override; 28 ~SyntheticPointerAction() override;
23 29
24 SyntheticGesture::Result ForwardInputEvents( 30 SyntheticGesture::Result ForwardInputEvents(
25 const base::TimeTicks& timestamp, 31 const base::TimeTicks& timestamp,
26 SyntheticGestureTarget* target) override; 32 SyntheticGestureTarget* target) override;
27 33
28 void ForwardTouchOrMouseInputEvents(const base::TimeTicks& timestamp, 34 private:
29 SyntheticGestureTarget* target); 35 explicit SyntheticPointerAction(const SyntheticPointerActionParams& params);
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 }
30 43
31 private: 44 // Check if the user inputs in the SyntheticPointerActionParams can generate
45 // a valid sequence of pointer actions.
46 bool UserInputCheck(const SyntheticPointerActionParams& params);
47
48 // SyntheticGestureController is responsible to create the
49 // SyntheticPointerActions and control when to forward them.
50 // This will be passed from SyntheticGestureController, which will reset its
51 // value to push a new batch of action parameters.
52 // This contains a list of pointer actions which will be dispatched together.
53 const std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list_;
54 // These two objects will be owned by SyntheticGestureController, which
55 // will manage their lifetime by initiating them when it starts processing a
56 // pointer action sequence and resetting them when it finishes.
57 SyntheticPointer* synthetic_pointer_;
58 IndexMap* index_map_;
59
32 SyntheticPointerActionParams params_; 60 SyntheticPointerActionParams params_;
33 SyntheticPointer* synthetic_pointer_;
34 61
35 DISALLOW_COPY_AND_ASSIGN(SyntheticPointerAction); 62 DISALLOW_COPY_AND_ASSIGN(SyntheticPointerAction);
36 }; 63 };
37 64
38 } // namespace content 65 } // namespace content
39 66
40 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ 67 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698