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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ceec9ff9afe788c099412a0b80798ac850a5e630 |
| --- /dev/null |
| +++ b/content/common/input/synthetic_pointer_action_params.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ |
| +#define CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ |
| + |
| +#include "base/logging.h" |
| +#include "content/common/content_export.h" |
| +#include "content/common/input/input_param_traits.h" |
| +#include "content/common/input/synthetic_gesture_params.h" |
| +#include "ui/gfx/geometry/point_f.h" |
| + |
| +namespace content { |
| + |
| +struct CONTENT_EXPORT SyntheticPointerActionParams |
| + : public SyntheticGestureParams { |
| + public: |
| + SyntheticPointerActionParams(); |
| + SyntheticPointerActionParams(PointerActionType type); |
| + SyntheticPointerActionParams(const SyntheticPointerActionParams& other); |
| + ~SyntheticPointerActionParams() override; |
| + |
| + GestureType GetGestureType() const override; |
| + |
| + static const SyntheticPointerActionParams* Cast( |
| + const SyntheticGestureParams* gesture_params); |
| + |
| + void set_pointer_action_type( |
| + SyntheticGestureParams::PointerActionType pointer_action_type) { |
| + pointer_action_type_arg = pointer_action_type; |
| + } |
| + |
| + void set_index(int index) { |
| + DCHECK(pointer_action_type_arg != |
| + SyntheticGestureParams::PointerActionType::PROCESS); |
| + index_arg = index; |
| + } |
| + |
| + void set_position(const gfx::PointF& position) { |
| + DCHECK(pointer_action_type_arg == |
| + SyntheticGestureParams::PointerActionType::PRESS || |
| + pointer_action_type_arg == |
| + SyntheticGestureParams::PointerActionType::MOVE); |
| + position_arg = position; |
| + } |
| + |
| + SyntheticGestureParams::PointerActionType pointer_action_type() const { |
| + return pointer_action_type_arg; |
| + } |
| + |
| + int index() const { |
| + DCHECK(pointer_action_type_arg != |
| + SyntheticGestureParams::PointerActionType::PROCESS); |
| + return index_arg; |
| + } |
| + |
| + gfx::PointF position() const { |
| + DCHECK(pointer_action_type_arg == |
| + SyntheticGestureParams::PointerActionType::PRESS || |
| + pointer_action_type_arg == |
| + SyntheticGestureParams::PointerActionType::MOVE); |
| + return position_arg; |
| + } |
| + |
| + private: |
| + friend struct IPC::ParamTraits<content::SyntheticPointerActionParams>; |
| + |
| + SyntheticGestureParams::PointerActionType pointer_action_type_arg; |
| + gfx::PointF position_arg; |
|
tdresser
2016/03/17 18:25:29
Add comments indicating under what circumstances t
lanwei
2016/03/22 00:33:43
Done.
|
| + int index_arg; |
| +}; |
| +} // namespace content |
| + |
| +#endif // CONTENT_COMMON_INPUT_SYNTHETIC_POINTER_ACTION_PARAMS_H_ |