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

Side by Side Diff: content/common/input/synthetic_pointer_action_params.h

Issue 1707943002: Add SyntheticPointerActionParams used in Chromedriver extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes in synthetic_gesture_controller_unittest.cc Created 4 years, 9 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
(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 // Actions are queued up until we receive a PROCESS action, at which point
20 // we'll dispatch all queued events.
21 enum class PointerActionType {
22 NOT_INITIALIZED,
23 PRESS,
24 MOVE,
25 RELEASE,
26 PROCESS,
27 POINTER_ACTION_TYPE_MAX = PROCESS
28 };
29
30 SyntheticPointerActionParams();
31 SyntheticPointerActionParams(PointerActionType type);
32 SyntheticPointerActionParams(const SyntheticPointerActionParams& other);
33 ~SyntheticPointerActionParams() override;
34
35 GestureType GetGestureType() const override;
36
37 static const SyntheticPointerActionParams* Cast(
38 const SyntheticGestureParams* gesture_params);
39
40 void set_pointer_action_type(PointerActionType pointer_action_type) {
41 pointer_action_type_ = pointer_action_type;
42 }
43
44 void set_index(int index) {
45 DCHECK(pointer_action_type_ != PointerActionType::PROCESS);
46 index_ = index;
47 }
48
49 void set_position(const gfx::PointF& position) {
50 DCHECK(pointer_action_type_ == PointerActionType::PRESS ||
51 pointer_action_type_ == PointerActionType::MOVE);
52 position_ = position;
53 }
54
55 PointerActionType pointer_action_type() const { return pointer_action_type_; }
56
57 int index() const {
58 DCHECK(pointer_action_type_ != PointerActionType::PROCESS);
59 return index_;
60 }
61
62 gfx::PointF position() const {
63 DCHECK(pointer_action_type_ == PointerActionType::PRESS ||
64 pointer_action_type_ == PointerActionType::MOVE);
65 return position_;
66 }
67
68 private:
69 friend struct IPC::ParamTraits<content::SyntheticPointerActionParams>;
70
71 PointerActionType pointer_action_type_;
72 // Pass a position value when sending a press or move action.
73 gfx::PointF position_;
74 // Pass an index value except the pointer_action_type_ is PROCESS.
samuong 2016/03/29 20:51:25 "except if"?
lanwei 2016/03/30 21:02:53 Done.
75 int index_;
76 };
77
78 } // namespace content
79
80 #endif // CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698