Chromium Code Reviews| Index: content/common/input/synthetic_pointer_action_params.h |
| diff --git a/content/common/input/synthetic_pointer_action_params.h b/content/common/input/synthetic_pointer_action_params.h |
| index dc6fa500fb11815d456d1e295c7efbf0b01ac994..3833f84bcc58bd751cd2c6943710220a5e106dc8 100644 |
| --- a/content/common/input/synthetic_pointer_action_params.h |
| +++ b/content/common/input/synthetic_pointer_action_params.h |
| @@ -18,41 +18,41 @@ struct FuzzTraits; |
| namespace content { |
| -struct CONTENT_EXPORT SyntheticPointerActionParams |
| - : public SyntheticGestureParams { |
| +struct CONTENT_EXPORT SyntheticPointerActionParams { |
| public: |
| // All the pointer actions that will be dispatched together will be grouped |
| - // in an array. A FINISH action will be received when we reach the end of the |
| - // action sequence. |
| + // in an array. |
| enum class PointerActionType { |
| NOT_INITIALIZED, |
| PRESS, |
| MOVE, |
| RELEASE, |
| - IDLE, |
| - FINISH, |
| - POINTER_ACTION_TYPE_MAX = FINISH |
| + POINTER_ACTION_TYPE_MAX = RELEASE |
| }; |
| SyntheticPointerActionParams(); |
| - SyntheticPointerActionParams(PointerActionType action_type, |
| - GestureSourceType source_type); |
| - SyntheticPointerActionParams(const SyntheticPointerActionParams& other); |
| - ~SyntheticPointerActionParams() override; |
| - |
| - GestureType GetGestureType() const override; |
| - |
| - static const SyntheticPointerActionParams* Cast( |
| - const SyntheticGestureParams* gesture_params); |
| + SyntheticPointerActionParams( |
| + PointerActionType action_type, |
| + SyntheticGestureParams::GestureSourceType source_type); |
| + ~SyntheticPointerActionParams(); |
| void set_pointer_action_type(PointerActionType pointer_action_type) { |
| pointer_action_type_ = pointer_action_type; |
| } |
| + void set_gesture_source_type( |
| + SyntheticGestureParams::GestureSourceType gesture_source_type) { |
| + gesture_source_type_ = gesture_source_type; |
| + } |
| + |
| void set_index(int index) { |
| - DCHECK(pointer_action_type_ != PointerActionType::FINISH); |
| // For mouse pointers, the index should always be 0. |
|
tdresser
2016/12/13 14:37:44
Given the comment, let's switch the condition here
lanwei
2016/12/18 17:35:55
Done.
|
| - DCHECK(gesture_source_type != MOUSE_INPUT || index == 0); |
| + if (gesture_source_type_ != SyntheticGestureParams::MOUSE_INPUT) { |
| + DCHECK_GE(index, 0); |
| + DCHECK_LT(index, blink::WebTouchEvent::kTouchesLengthCap); |
| + } else { |
| + DCHECK_EQ(index, 0); |
| + } |
| index_ = index; |
| } |
| @@ -64,10 +64,18 @@ struct CONTENT_EXPORT SyntheticPointerActionParams |
| PointerActionType pointer_action_type() const { return pointer_action_type_; } |
| + SyntheticGestureParams::GestureSourceType gesture_source_type() const { |
| + return gesture_source_type_; |
| + } |
| + |
| int index() const { |
| - DCHECK(pointer_action_type_ != PointerActionType::FINISH); |
| // For mouse pointers, the index should always be 0. |
| - DCHECK(gesture_source_type != MOUSE_INPUT || index_ == 0); |
| + if (gesture_source_type_ != SyntheticGestureParams::MOUSE_INPUT) { |
|
tdresser
2016/12/13 14:37:43
Same as above, switch the clause order.
lanwei
2016/12/18 17:35:55
Done.
|
| + DCHECK_GE(index_, 0); |
| + DCHECK_LT(index_, blink::WebTouchEvent::kTouchesLengthCap); |
| + } else { |
| + DCHECK_EQ(index_, 0); |
| + } |
| return index_; |
| } |
| @@ -82,12 +90,13 @@ struct CONTENT_EXPORT SyntheticPointerActionParams |
| friend struct ipc_fuzzer::FuzzTraits<content::SyntheticPointerActionParams>; |
| PointerActionType pointer_action_type_; |
| + SyntheticGestureParams::GestureSourceType gesture_source_type_; |
| // Pass a position value when sending a press or move action. |
| gfx::PointF position_; |
| - // Pass an index value except if the pointer_action_type_ is PROCESS. |
| + // Pass an index value which is the index of the pointer in the list. |
|
tdresser
2016/12/13 14:37:44
This is a bit confusing.
Maybe something like:
//
lanwei
2016/12/18 17:35:55
Done.
|
| int index_; |
| }; |
| } // namespace content |
| -#endif // CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ |
| +#endif // CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ |