| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/renderer_host/input/synthetic_pointer_action.h" | 5 #include "content/browser/renderer_host/input/synthetic_pointer_action.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 8 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 9 #include "ui/events/latency_info.h" | 9 #include "ui/events/latency_info.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 : SyntheticGesture::GESTURE_RUNNING; | 47 : SyntheticGesture::GESTURE_RUNNING; |
| 48 } | 48 } |
| 49 | 49 |
| 50 SyntheticPointerAction::GestureState | 50 SyntheticPointerAction::GestureState |
| 51 SyntheticPointerAction::ForwardTouchOrMouseInputEvents( | 51 SyntheticPointerAction::ForwardTouchOrMouseInputEvents( |
| 52 const base::TimeTicks& timestamp, | 52 const base::TimeTicks& timestamp, |
| 53 SyntheticGestureTarget* target) { | 53 SyntheticGestureTarget* target) { |
| 54 DCHECK_LT(num_actions_dispatched_, params_.params.size()); | 54 DCHECK_LT(num_actions_dispatched_, params_.params.size()); |
| 55 SyntheticPointerActionListParams::ParamList& param_list = | 55 SyntheticPointerActionListParams::ParamList& param_list = |
| 56 params_.params[num_actions_dispatched_]; | 56 params_.params[num_actions_dispatched_]; |
| 57 for (SyntheticPointerActionParams& param : param_list) { | 57 for (const SyntheticPointerActionParams& param : param_list) { |
| 58 if (!synthetic_pointer_driver_->UserInputCheck(param)) | 58 if (!synthetic_pointer_driver_->UserInputCheck(param)) |
| 59 return INVALID; | 59 return INVALID; |
| 60 | 60 |
| 61 switch (param.pointer_action_type()) { | 61 switch (param.pointer_action_type()) { |
| 62 case SyntheticPointerActionParams::PointerActionType::PRESS: | 62 case SyntheticPointerActionParams::PointerActionType::PRESS: |
| 63 synthetic_pointer_driver_->Press(param.position().x(), | 63 synthetic_pointer_driver_->Press(param.position().x(), |
| 64 param.position().y(), param.index()); | 64 param.position().y(), param.index(), |
| 65 param.button()); |
| 65 break; | 66 break; |
| 66 case SyntheticPointerActionParams::PointerActionType::MOVE: | 67 case SyntheticPointerActionParams::PointerActionType::MOVE: |
| 67 synthetic_pointer_driver_->Move(param.position().x(), | 68 synthetic_pointer_driver_->Move(param.position().x(), |
| 68 param.position().y(), param.index()); | 69 param.position().y(), param.index()); |
| 69 break; | 70 break; |
| 70 case SyntheticPointerActionParams::PointerActionType::RELEASE: | 71 case SyntheticPointerActionParams::PointerActionType::RELEASE: |
| 71 synthetic_pointer_driver_->Release(param.index()); | 72 synthetic_pointer_driver_->Release(param.index(), param.button()); |
| 72 break; | 73 break; |
| 73 case SyntheticPointerActionParams::PointerActionType::IDLE: | 74 case SyntheticPointerActionParams::PointerActionType::IDLE: |
| 74 break; | 75 break; |
| 75 case SyntheticPointerActionParams::PointerActionType::NOT_INITIALIZED: | 76 case SyntheticPointerActionParams::PointerActionType::NOT_INITIALIZED: |
| 76 return INVALID; | 77 return INVALID; |
| 77 } | 78 } |
| 78 } | 79 } |
| 79 synthetic_pointer_driver_->DispatchEvent(target, timestamp); | 80 synthetic_pointer_driver_->DispatchEvent(target, timestamp); |
| 80 num_actions_dispatched_++; | 81 num_actions_dispatched_++; |
| 81 if (num_actions_dispatched_ == params_.params.size()) | 82 if (num_actions_dispatched_ == params_.params.size()) |
| 82 return DONE; | 83 return DONE; |
| 83 else | 84 else |
| 84 return RUNNING; | 85 return RUNNING; |
| 85 } | 86 } |
| 86 | 87 |
| 87 } // namespace content | 88 } // namespace content |
| OLD | NEW |