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

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

Issue 2178153002: Prepare SyntheticPointerAction to handle mouse actions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 4 years, 4 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
« no previous file with comments | « content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ 5 #ifndef CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_
6 #define CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ 6 #define CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/common/input/input_param_traits.h" 10 #include "content/common/input/input_param_traits.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 static const SyntheticPointerActionParams* Cast( 44 static const SyntheticPointerActionParams* Cast(
45 const SyntheticGestureParams* gesture_params); 45 const SyntheticGestureParams* gesture_params);
46 46
47 void set_pointer_action_type(PointerActionType pointer_action_type) { 47 void set_pointer_action_type(PointerActionType pointer_action_type) {
48 pointer_action_type_ = pointer_action_type; 48 pointer_action_type_ = pointer_action_type;
49 } 49 }
50 50
51 void set_index(int index) { 51 void set_index(int index) {
52 DCHECK(pointer_action_type_ != PointerActionType::PROCESS && 52 DCHECK(pointer_action_type_ != PointerActionType::PROCESS &&
53 pointer_action_type_ != PointerActionType::FINISH); 53 pointer_action_type_ != PointerActionType::FINISH);
54 // For all mouse pointer actions, the index should always be 0.
55 DCHECK(gesture_source_type != MOUSE_INPUT || index == 0);
54 index_ = index; 56 index_ = index;
55 } 57 }
56 58
57 void set_position(const gfx::PointF& position) { 59 void set_position(const gfx::PointF& position) {
58 DCHECK(pointer_action_type_ == PointerActionType::PRESS || 60 DCHECK(pointer_action_type_ == PointerActionType::PRESS ||
59 pointer_action_type_ == PointerActionType::MOVE); 61 pointer_action_type_ == PointerActionType::MOVE);
60 position_ = position; 62 position_ = position;
61 } 63 }
62 64
63 PointerActionType pointer_action_type() const { return pointer_action_type_; } 65 PointerActionType pointer_action_type() const { return pointer_action_type_; }
64 66
65 int index() const { 67 int index() const {
66 DCHECK(pointer_action_type_ != PointerActionType::PROCESS && 68 DCHECK(pointer_action_type_ != PointerActionType::PROCESS &&
67 pointer_action_type_ != PointerActionType::FINISH); 69 pointer_action_type_ != PointerActionType::FINISH);
70 DCHECK(gesture_source_type != MOUSE_INPUT || index_ == 0);
68 return index_; 71 return index_;
69 } 72 }
70 73
71 gfx::PointF position() const { 74 gfx::PointF position() const {
72 DCHECK(pointer_action_type_ == PointerActionType::PRESS || 75 DCHECK(pointer_action_type_ == PointerActionType::PRESS ||
73 pointer_action_type_ == PointerActionType::MOVE); 76 pointer_action_type_ == PointerActionType::MOVE);
74 return position_; 77 return position_;
75 } 78 }
76 79
77 private: 80 private:
78 friend struct IPC::ParamTraits<content::SyntheticPointerActionParams>; 81 friend struct IPC::ParamTraits<content::SyntheticPointerActionParams>;
79 friend struct ipc_fuzzer::FuzzTraits<content::SyntheticPointerActionParams>; 82 friend struct ipc_fuzzer::FuzzTraits<content::SyntheticPointerActionParams>;
80 83
81 PointerActionType pointer_action_type_; 84 PointerActionType pointer_action_type_;
82 // Pass a position value when sending a press or move action. 85 // Pass a position value when sending a press or move action.
83 gfx::PointF position_; 86 gfx::PointF position_;
84 // Pass an index value except if the pointer_action_type_ is PROCESS. 87 // Pass an index value except if the pointer_action_type_ is PROCESS.
85 int index_; 88 int index_;
86 }; 89 };
87 90
88 } // namespace content 91 } // namespace content
89 92
90 #endif // CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ 93 #endif // CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/synthetic_pointer_action_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698