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

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

Issue 2336803003: Make SyntheticPointerAction to flush the pointer action sequence (Closed)
Patch Set: pointer controller 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> 8 #include <array>
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "content/browser/renderer_host/input/synthetic_gesture.h" 10 #include "content/browser/renderer_host/input/synthetic_gesture.h"
11 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" 11 #include "content/browser/renderer_host/input/synthetic_gesture_target.h"
12 #include "content/browser/renderer_host/input/synthetic_pointer.h" 12 #include "content/browser/renderer_host/input/synthetic_pointer.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/common/input/synthetic_pointer_action_list_params.h"
14 #include "content/common/input/synthetic_pointer_action_params.h" 15 #include "content/common/input/synthetic_pointer_action_params.h"
15 16
16 using blink::WebTouchEvent; 17 using blink::WebTouchEvent;
17 18
18 namespace content { 19 namespace content {
19 20
20 class CONTENT_EXPORT SyntheticPointerAction : public SyntheticGesture { 21 class CONTENT_EXPORT SyntheticPointerAction : public SyntheticGesture {
21 public: 22 public:
22 using IndexMap = std::array<int, WebTouchEvent::kTouchesLengthCap>; 23 using IndexMap = std::array<int, WebTouchEvent::kTouchesLengthCap>;
tdresser 2016/10/31 14:22:57 The way IndexMap is exposed to consumers is a bit
tdresser 2016/10/31 14:22:57 It might make sense to wrap this up in a class, so
lanwei 2016/12/04 18:08:02 Done.
23 24
24 SyntheticPointerAction( 25 SyntheticPointerAction(const SyntheticPointerActionListParams& params,
25 std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list, 26 SyntheticPointer* synthetic_pointer,
26 SyntheticPointer* synthetic_pointer, 27 IndexMap* index_map);
27 IndexMap* index_map);
28 ~SyntheticPointerAction() override; 28 ~SyntheticPointerAction() override;
29 29
30 SyntheticGesture::Result ForwardInputEvents( 30 SyntheticGesture::Result ForwardInputEvents(
31 const base::TimeTicks& timestamp, 31 const base::TimeTicks& timestamp,
32 SyntheticGestureTarget* target) override; 32 SyntheticGestureTarget* target) override;
33 33
34 private: 34 private:
35 explicit SyntheticPointerAction(const SyntheticPointerActionParams& params); 35 explicit SyntheticPointerAction(
36 const SyntheticPointerActionListParams& params);
36 SyntheticGesture::Result ForwardTouchOrMouseInputEvents( 37 SyntheticGesture::Result ForwardTouchOrMouseInputEvents(
37 const base::TimeTicks& timestamp, 38 const base::TimeTicks& timestamp,
38 SyntheticGestureTarget* target); 39 SyntheticGestureTarget* target);
39 int GetPointIndex(int index) const { return (*index_map_)[index]; } 40 int GetPointIndex(int index) const { return (*index_map_)[index]; }
40 void SetPointIndex(int index, int point_index) { 41 void SetPointIndex(int index, int point_index) {
41 (*index_map_)[index] = point_index; 42 (*index_map_)[index] = point_index;
42 } 43 }
43 44
44 // Check if the user inputs in the SyntheticPointerActionParams can generate 45 // Check if the user inputs in the SyntheticPointerActionListParams can
45 // a valid sequence of pointer actions. 46 // generate a valid sequence of pointer actions.
46 bool UserInputCheck(const SyntheticPointerActionParams& params); 47 bool UserInputCheck(const SyntheticPointerActionParams& params);
47 48
48 // SyntheticGestureController is responsible to create the 49 // SyntheticGestureController is responsible to create the
49 // SyntheticPointerActions and control when to forward them. 50 // SyntheticPointerActions and control when to forward them.
50 // This will be passed from SyntheticGestureController, which will reset its 51 // This will be passed from SyntheticGestureController, which will reset its
51 // value to push a new batch of action parameters. 52 // value to push a new batch of action parameters.
52 // This contains a list of pointer actions which will be dispatched together. 53
53 const std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list_; 54 // This contains a list of pointer actions which will be dispatched together
55 // in one frame.
56 SyntheticPointerActionListParams params_;
57
54 // These two objects will be owned by SyntheticGestureController, which 58 // These two objects will be owned by SyntheticGestureController, which
55 // will manage their lifetime by initiating them when it starts processing a 59 // will manage their lifetime by initiating them when it starts processing a
56 // pointer action sequence and resetting them when it finishes. 60 // pointer action sequence and resetting them when it finishes.
57 SyntheticPointer* synthetic_pointer_; 61 SyntheticPointer* synthetic_pointer_;
58 IndexMap* index_map_; 62 IndexMap* index_map_;
59 63
60 SyntheticPointerActionParams params_;
61
62 DISALLOW_COPY_AND_ASSIGN(SyntheticPointerAction); 64 DISALLOW_COPY_AND_ASSIGN(SyntheticPointerAction);
63 }; 65 };
64 66
65 } // namespace content 67 } // namespace content
66 68
67 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ 69 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698