| OLD | NEW |
| 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 #include "content/common/input/synthetic_pointer_action_params.h" | 5 #include "content/common/input/synthetic_pointer_action_params.h" |
| 6 | 6 |
| 7 namespace content { | 7 namespace content { |
| 8 | 8 |
| 9 SyntheticPointerActionParams::SyntheticPointerActionParams() | 9 SyntheticPointerActionParams::SyntheticPointerActionParams() |
| 10 : pointer_action_type_(PointerActionType::NOT_INITIALIZED) { | 10 : pointer_action_type_(PointerActionType::NOT_INITIALIZED), index_(0) {} |
| 11 index_ = gesture_source_type != MOUSE_INPUT ? -1 : 0; | |
| 12 } | |
| 13 | 11 |
| 14 SyntheticPointerActionParams::SyntheticPointerActionParams( | 12 SyntheticPointerActionParams::SyntheticPointerActionParams( |
| 15 PointerActionType action_type, | 13 PointerActionType action_type) |
| 16 GestureSourceType source_type) | 14 : pointer_action_type_(action_type), index_(0) {} |
| 17 : pointer_action_type_(action_type) { | |
| 18 gesture_source_type = source_type; | |
| 19 index_ = gesture_source_type != MOUSE_INPUT ? -1 : 0; | |
| 20 } | |
| 21 | |
| 22 SyntheticPointerActionParams::SyntheticPointerActionParams( | |
| 23 const SyntheticPointerActionParams& other) | |
| 24 : SyntheticGestureParams(other), | |
| 25 pointer_action_type_(other.pointer_action_type()) { | |
| 26 switch (other.pointer_action_type()) { | |
| 27 case PointerActionType::PRESS: | |
| 28 case PointerActionType::MOVE: | |
| 29 index_ = other.index(); | |
| 30 position_ = other.position(); | |
| 31 break; | |
| 32 case PointerActionType::RELEASE: | |
| 33 case PointerActionType::IDLE: | |
| 34 case PointerActionType::NOT_INITIALIZED: | |
| 35 index_ = other.index(); | |
| 36 break; | |
| 37 case PointerActionType::FINISH: | |
| 38 break; | |
| 39 } | |
| 40 } | |
| 41 | 15 |
| 42 SyntheticPointerActionParams::~SyntheticPointerActionParams() {} | 16 SyntheticPointerActionParams::~SyntheticPointerActionParams() {} |
| 43 | 17 |
| 44 SyntheticGestureParams::GestureType | 18 } // namespace content |
| 45 SyntheticPointerActionParams::GetGestureType() const { | |
| 46 return POINTER_ACTION; | |
| 47 } | |
| 48 | |
| 49 const SyntheticPointerActionParams* SyntheticPointerActionParams::Cast( | |
| 50 const SyntheticGestureParams* gesture_params) { | |
| 51 DCHECK(gesture_params); | |
| 52 DCHECK_EQ(POINTER_ACTION, gesture_params->GetGestureType()); | |
| 53 return static_cast<const SyntheticPointerActionParams*>(gesture_params); | |
| 54 } | |
| 55 | |
| 56 } // namespace content | |
| OLD | NEW |