| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input_router_impl.h" | 5 #include "content/browser/renderer_host/input/input_router_impl.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #elif defined(USE_AURA) | 78 #elif defined(USE_AURA) |
| 79 double GetTouchMoveSlopSuppressionLengthDips() { | 79 double GetTouchMoveSlopSuppressionLengthDips() { |
| 80 return ui::GestureConfiguration::max_touch_move_in_pixels_for_click(); | 80 return ui::GestureConfiguration::max_touch_move_in_pixels_for_click(); |
| 81 } | 81 } |
| 82 #else | 82 #else |
| 83 double GetTouchMoveSlopSuppressionLengthDips() { | 83 double GetTouchMoveSlopSuppressionLengthDips() { |
| 84 return 0; | 84 return 0; |
| 85 } | 85 } |
| 86 #endif | 86 #endif |
| 87 | 87 |
| 88 TouchEventQueue::TouchScrollingMode GetTouchScrollingMode() { |
| 89 std::string modeString = CommandLine::ForCurrentProcess()-> |
| 90 GetSwitchValueASCII(switches::kTouchScrollingMode); |
| 91 if (modeString == switches::kTouchScrollingModeSyncTouchmove) |
| 92 return TouchEventQueue::TOUCH_SCROLLING_MODE_SYNC_TOUCHMOVE; |
| 93 if (modeString == switches::kTouchScrollingModeAbsorbTouchmove) |
| 94 return TouchEventQueue::TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE; |
| 95 if (modeString != "" && |
| 96 modeString != switches::kTouchScrollingModeTouchcancel) |
| 97 LOG(ERROR) << "Invalid --touch-scrolling-mode option: " << modeString; |
| 98 return TouchEventQueue::TOUCH_SCROLLING_MODE_DEFAULT; |
| 99 } |
| 100 |
| 88 GestureEventWithLatencyInfo MakeGestureEvent(WebInputEvent::Type type, | 101 GestureEventWithLatencyInfo MakeGestureEvent(WebInputEvent::Type type, |
| 89 double timestamp_seconds, | 102 double timestamp_seconds, |
| 90 int x, | 103 int x, |
| 91 int y, | 104 int y, |
| 92 int modifiers, | 105 int modifiers, |
| 93 const ui::LatencyInfo latency) { | 106 const ui::LatencyInfo latency) { |
| 94 WebGestureEvent result; | 107 WebGestureEvent result; |
| 95 | 108 |
| 96 result.type = type; | 109 result.type = type; |
| 97 result.x = x; | 110 result.x = x; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 move_caret_pending_(false), | 142 move_caret_pending_(false), |
| 130 mouse_move_pending_(false), | 143 mouse_move_pending_(false), |
| 131 mouse_wheel_pending_(false), | 144 mouse_wheel_pending_(false), |
| 132 touch_ack_timeout_enabled_(false), | 145 touch_ack_timeout_enabled_(false), |
| 133 touch_ack_timeout_delay_ms_(std::numeric_limits<size_t>::max()), | 146 touch_ack_timeout_delay_ms_(std::numeric_limits<size_t>::max()), |
| 134 current_ack_source_(ACK_SOURCE_NONE), | 147 current_ack_source_(ACK_SOURCE_NONE), |
| 135 gesture_event_queue_(new GestureEventQueue(this, this)) { | 148 gesture_event_queue_(new GestureEventQueue(this, this)) { |
| 136 DCHECK(sender); | 149 DCHECK(sender); |
| 137 DCHECK(client); | 150 DCHECK(client); |
| 138 DCHECK(ack_handler); | 151 DCHECK(ack_handler); |
| 139 touch_event_queue_.reset( | 152 touch_event_queue_.reset(new TouchEventQueue( |
| 140 new TouchEventQueue(this, GetTouchMoveSlopSuppressionLengthDips())); | 153 this, GetTouchScrollingMode(), GetTouchMoveSlopSuppressionLengthDips())); |
| 141 touch_ack_timeout_enabled_ = | 154 touch_ack_timeout_enabled_ = |
| 142 GetTouchAckTimeoutDelayMs(&touch_ack_timeout_delay_ms_); | 155 GetTouchAckTimeoutDelayMs(&touch_ack_timeout_delay_ms_); |
| 143 touch_event_queue_->SetAckTimeoutEnabled(touch_ack_timeout_enabled_, | 156 touch_event_queue_->SetAckTimeoutEnabled(touch_ack_timeout_enabled_, |
| 144 touch_ack_timeout_delay_ms_); | 157 touch_ack_timeout_delay_ms_); |
| 145 } | 158 } |
| 146 | 159 |
| 147 InputRouterImpl::~InputRouterImpl() {} | 160 InputRouterImpl::~InputRouterImpl() {} |
| 148 | 161 |
| 149 void InputRouterImpl::Flush() {} | 162 void InputRouterImpl::Flush() {} |
| 150 | 163 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 } | 334 } |
| 322 | 335 |
| 323 void InputRouterImpl::OnTouchEventAck(const TouchEventWithLatencyInfo& event, | 336 void InputRouterImpl::OnTouchEventAck(const TouchEventWithLatencyInfo& event, |
| 324 InputEventAckState ack_result) { | 337 InputEventAckState ack_result) { |
| 325 ack_handler_->OnTouchEventAck(event, ack_result); | 338 ack_handler_->OnTouchEventAck(event, ack_result); |
| 326 } | 339 } |
| 327 | 340 |
| 328 void InputRouterImpl::OnGestureEventAck( | 341 void InputRouterImpl::OnGestureEventAck( |
| 329 const GestureEventWithLatencyInfo& event, | 342 const GestureEventWithLatencyInfo& event, |
| 330 InputEventAckState ack_result) { | 343 InputEventAckState ack_result) { |
| 344 touch_event_queue_->OnGestureEventAck(event, ack_result); |
| 331 ProcessAckForOverscroll(event.event, ack_result); | 345 ProcessAckForOverscroll(event.event, ack_result); |
| 332 ack_handler_->OnGestureEventAck(event, ack_result); | 346 ack_handler_->OnGestureEventAck(event, ack_result); |
| 333 } | 347 } |
| 334 | 348 |
| 335 bool InputRouterImpl::SendSelectRange(scoped_ptr<IPC::Message> message) { | 349 bool InputRouterImpl::SendSelectRange(scoped_ptr<IPC::Message> message) { |
| 336 DCHECK(message->type() == InputMsg_SelectRange::ID); | 350 DCHECK(message->type() == InputMsg_SelectRange::ID); |
| 337 if (select_range_pending_) { | 351 if (select_range_pending_) { |
| 338 next_selection_range_ = message.Pass(); | 352 next_selection_range_ = message.Pass(); |
| 339 return true; | 353 return true; |
| 340 } | 354 } |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 break; | 763 break; |
| 750 } | 764 } |
| 751 } | 765 } |
| 752 | 766 |
| 753 bool InputRouterImpl::IsInOverscrollGesture() const { | 767 bool InputRouterImpl::IsInOverscrollGesture() const { |
| 754 OverscrollController* controller = client_->GetOverscrollController(); | 768 OverscrollController* controller = client_->GetOverscrollController(); |
| 755 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; | 769 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; |
| 756 } | 770 } |
| 757 | 771 |
| 758 } // namespace content | 772 } // namespace content |
| OLD | NEW |