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

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

Issue 2478423002: Rename SyntheticPointer to SyntheticPointerDriver (Closed)
Patch Set: Move valid user input in SyntheticPointerDriver Created 4 years, 1 month 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>
9 #include "base/macros.h" 8 #include "base/macros.h"
10 #include "content/browser/renderer_host/input/synthetic_gesture.h" 9 #include "content/browser/renderer_host/input/synthetic_gesture.h"
11 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" 10 #include "content/browser/renderer_host/input/synthetic_gesture_target.h"
12 #include "content/browser/renderer_host/input/synthetic_pointer.h" 11 #include "content/browser/renderer_host/input/synthetic_pointer_driver.h"
13 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
14 #include "content/common/input/synthetic_pointer_action_params.h" 13 #include "content/common/input/synthetic_pointer_action_params.h"
15 14
16 using blink::WebTouchEvent; 15 using blink::WebTouchEvent;
17 16
18 namespace content { 17 namespace content {
19 18
20 class CONTENT_EXPORT SyntheticPointerAction : public SyntheticGesture { 19 class CONTENT_EXPORT SyntheticPointerAction : public SyntheticGesture {
21 public: 20 public:
22 using IndexMap = std::array<int, WebTouchEvent::kTouchesLengthCap>;
23
24 SyntheticPointerAction( 21 SyntheticPointerAction(
25 std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list, 22 std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list,
26 SyntheticPointer* synthetic_pointer, 23 SyntheticPointerDriver* synthetic_pointer_driver);
27 IndexMap* index_map);
28 ~SyntheticPointerAction() override; 24 ~SyntheticPointerAction() override;
29 25
30 SyntheticGesture::Result ForwardInputEvents( 26 SyntheticGesture::Result ForwardInputEvents(
31 const base::TimeTicks& timestamp, 27 const base::TimeTicks& timestamp,
32 SyntheticGestureTarget* target) override; 28 SyntheticGestureTarget* target) override;
33 29
34 private: 30 private:
35 explicit SyntheticPointerAction(const SyntheticPointerActionParams& params); 31 explicit SyntheticPointerAction(const SyntheticPointerActionParams& params);
36 SyntheticGesture::Result ForwardTouchOrMouseInputEvents( 32 SyntheticGesture::Result ForwardTouchOrMouseInputEvents(
37 const base::TimeTicks& timestamp, 33 const base::TimeTicks& timestamp,
38 SyntheticGestureTarget* target); 34 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 35
44 // Check if the user inputs in the SyntheticPointerActionParams can generate
45 // a valid sequence of pointer actions.
46 bool UserInputCheck(const SyntheticPointerActionParams& params); 36 bool UserInputCheck(const SyntheticPointerActionParams& params);
tdresser 2016/11/08 15:16:34 Why did we get rid of this comment?
47 37
48 // SyntheticGestureController is responsible to create the 38 // SyntheticGestureController is responsible to create the
49 // SyntheticPointerActions and control when to forward them. 39 // SyntheticPointerActions and control when to forward them.
50 // This will be passed from SyntheticGestureController, which will reset its 40 // This will be passed from SyntheticGestureController, which will reset its
51 // value to push a new batch of action parameters. 41 // value to push a new batch of action parameters.
52 // This contains a list of pointer actions which will be dispatched together. 42 // This contains a list of pointer actions which will be dispatched together.
53 const std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list_; 43 const std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list_;
54 // These two objects will be owned by SyntheticGestureController, which 44 // These two objects will be owned by SyntheticGestureController, which
55 // will manage their lifetime by initiating them when it starts processing a 45 // will manage their lifetime by initiating them when it starts processing a
56 // pointer action sequence and resetting them when it finishes. 46 // pointer action sequence and resetting them when it finishes.
57 SyntheticPointer* synthetic_pointer_; 47 SyntheticPointerDriver* synthetic_pointer_driver_;
58 IndexMap* index_map_;
59 48
60 SyntheticPointerActionParams params_; 49 SyntheticPointerActionParams params_;
61 50
62 DISALLOW_COPY_AND_ASSIGN(SyntheticPointerAction); 51 DISALLOW_COPY_AND_ASSIGN(SyntheticPointerAction);
63 }; 52 };
64 53
65 } // namespace content 54 } // namespace content
66 55
67 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ 56 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698