OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ | |
6 #define CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ | |
7 | |
8 #include "base/logging.h" | |
9 #include "content/common/content_export.h" | |
10 #include "content/common/input/input_param_traits.h" | |
11 #include "content/common/input/synthetic_gesture_params.h" | |
12 #include "ui/gfx/geometry/point_f.h" | |
13 | |
14 namespace content { | |
15 | |
16 struct CONTENT_EXPORT SyntheticPointerActionParams | |
17 : public SyntheticGestureParams { | |
18 public: | |
19 // When we send actions one by one, once we receive a PROCESS action, we will | |
20 // start to dispatch an event with all the pending actions. | |
21 // TODO(lanwei): we will pre-process the delay action in the | |
tdresser
2016/03/22 14:38:10
As the plan of record never involves putting the d
lanwei
2016/03/23 14:01:52
Done.
| |
22 // chromedrive_extension, here we do nothing for the delay. If the design | |
23 // changes, I will add a type for DELAY, see https://crbug.com/525187. | |
24 enum class PointerActionType { | |
25 NOT_INITIALIZED, | |
26 PRESS, | |
27 MOVE, | |
28 RELEASE, | |
29 PROCESS, | |
30 POINTER_ACTION_TYPE_MAX = PROCESS | |
31 }; | |
32 | |
33 SyntheticPointerActionParams(); | |
34 SyntheticPointerActionParams(PointerActionType type); | |
35 SyntheticPointerActionParams(const SyntheticPointerActionParams& other); | |
36 ~SyntheticPointerActionParams() override; | |
37 | |
38 GestureType GetGestureType() const override; | |
39 | |
40 static const SyntheticPointerActionParams* Cast( | |
41 const SyntheticGestureParams* gesture_params); | |
42 | |
43 void set_pointer_action_type(PointerActionType pointer_action_type) { | |
44 pointer_action_type_arg = pointer_action_type; | |
45 } | |
46 | |
47 void set_index(int index) { | |
48 DCHECK(pointer_action_type_arg != PointerActionType::PROCESS); | |
49 index_arg = index; | |
50 } | |
51 | |
52 void set_position(const gfx::PointF& position) { | |
53 DCHECK(pointer_action_type_arg == PointerActionType::PRESS || | |
54 pointer_action_type_arg == PointerActionType::MOVE); | |
55 position_arg = position; | |
56 } | |
57 | |
58 PointerActionType pointer_action_type() const { | |
59 return pointer_action_type_arg; | |
60 } | |
61 | |
62 int index() const { | |
63 DCHECK(pointer_action_type_arg != PointerActionType::PROCESS); | |
64 return index_arg; | |
65 } | |
66 | |
67 gfx::PointF position() const { | |
68 DCHECK(pointer_action_type_arg == PointerActionType::PRESS || | |
69 pointer_action_type_arg == PointerActionType::MOVE); | |
70 return position_arg; | |
71 } | |
72 | |
73 private: | |
74 friend struct IPC::ParamTraits<content::SyntheticPointerActionParams>; | |
75 | |
76 PointerActionType pointer_action_type_arg; | |
tdresser
2016/03/22 14:38:10
I'm not sure the |_arg| suffix is adding much valu
lanwei
2016/03/23 14:01:52
I feel maybe it is confusing to have variable's na
| |
77 // Pass a position value when sending a press or move action. | |
78 gfx::PointF position_arg; | |
79 // Pass an index value except the pointer_action_type_arg is PROCESS. | |
80 int index_arg; | |
81 }; | |
82 | |
83 } // namespace content | |
84 | |
85 #endif // CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ | |
OLD | NEW |