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