Chromium Code Reviews| Index: content/common/input/synthetic_pointer_action_params.cc |
| diff --git a/content/common/input/synthetic_pointer_action_params.cc b/content/common/input/synthetic_pointer_action_params.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4bea68f314b1541be034a8e3778728aa51fbc5bc |
| --- /dev/null |
| +++ b/content/common/input/synthetic_pointer_action_params.cc |
| @@ -0,0 +1,46 @@ |
| +// 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. |
| + |
| +#include "content/common/input/synthetic_pointer_action_params.h" |
| + |
| +namespace content { |
| + |
| +SyntheticPointerActionParams::SyntheticPointerActionParams() |
| + : pointer_action_type_(PointerActionType::NOT_INITIALIZED), index_(-1) {} |
| + |
| +SyntheticPointerActionParams::SyntheticPointerActionParams( |
| + PointerActionType type) |
| + : pointer_action_type_(type), index_(-1) {} |
| + |
| +SyntheticPointerActionParams::SyntheticPointerActionParams( |
| + const SyntheticPointerActionParams& other) |
| + : SyntheticGestureParams(other), |
| + pointer_action_type_(other.pointer_action_type()) { |
| + switch (other.pointer_action_type()) { |
| + case PointerActionType::PRESS: |
| + case PointerActionType::MOVE: |
| + position_ = other.position(); |
|
tdresser
2016/03/23 15:09:25
We generally avoid case statement fallthrough (exc
lanwei
2016/03/30 21:02:53
Done.
|
| + case PointerActionType::RELEASE: |
| + index_ = other.index(); |
| + break; |
| + default: |
| + break; |
| + } |
| +} |
| + |
| +SyntheticPointerActionParams::~SyntheticPointerActionParams() {} |
| + |
| +SyntheticGestureParams::GestureType |
| +SyntheticPointerActionParams::GetGestureType() const { |
| + return POINTER_ACTION; |
| +} |
| + |
| +const SyntheticPointerActionParams* SyntheticPointerActionParams::Cast( |
| + const SyntheticGestureParams* gesture_params) { |
| + DCHECK(gesture_params); |
| + DCHECK_EQ(POINTER_ACTION, gesture_params->GetGestureType()); |
| + return static_cast<const SyntheticPointerActionParams*>(gesture_params); |
| +} |
| + |
| +} // namespace content |