Chromium Code Reviews| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 case INPUT_EVENT_ACK_STATE_UNKNOWN: return "UNKNOWN"; | 108 case INPUT_EVENT_ACK_STATE_UNKNOWN: return "UNKNOWN"; |
| 109 case INPUT_EVENT_ACK_STATE_CONSUMED: return "CONSUMED"; | 109 case INPUT_EVENT_ACK_STATE_CONSUMED: return "CONSUMED"; |
| 110 case INPUT_EVENT_ACK_STATE_NOT_CONSUMED: return "NOT_CONSUMED"; | 110 case INPUT_EVENT_ACK_STATE_NOT_CONSUMED: return "NOT_CONSUMED"; |
| 111 case INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS: return "NO_CONSUMER_EXISTS"; | 111 case INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS: return "NO_CONSUMER_EXISTS"; |
| 112 case INPUT_EVENT_ACK_STATE_IGNORED: return "IGNORED"; | 112 case INPUT_EVENT_ACK_STATE_IGNORED: return "IGNORED"; |
| 113 } | 113 } |
| 114 DLOG(WARNING) << "Unhandled InputEventAckState in GetEventAckName."; | 114 DLOG(WARNING) << "Unhandled InputEventAckState in GetEventAckName."; |
| 115 return ""; | 115 return ""; |
| 116 } | 116 } |
| 117 | 117 |
| 118 TouchEventQueue::TouchScrollingMode GetTouchScrollingMode() | |
| 119 { | |
|
jdduke (slow)
2014/02/14 21:18:00
Nit: Move brace up a line. Also could you move th
tdresser
2014/02/14 21:24:40
Done.
| |
| 120 std::string modeString = CommandLine::ForCurrentProcess()-> | |
| 121 GetSwitchValueASCII(switches::kTouchScrollingMode); | |
| 122 if (modeString == switches::kTouchScrollingModeSyncTouchmove) | |
| 123 return TouchEventQueue::TOUCH_SCROLLING_MODE_SYNC_TOUCHMOVE; | |
| 124 if (modeString == switches::kTouchScrollingModeAbsorbTouchmove) | |
| 125 return TouchEventQueue::TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE; | |
| 126 if (modeString != "" && | |
| 127 modeString != switches::kTouchScrollingModeTouchcancel) | |
| 128 LOG(ERROR) << "Invalid --touch-scrolling-mode option: " << modeString; | |
| 129 return TouchEventQueue::TOUCH_SCROLLING_MODE_DEFAULT; | |
| 130 } | |
| 131 | |
| 118 } // namespace | 132 } // namespace |
| 119 | 133 |
| 120 InputRouterImpl::InputRouterImpl(IPC::Sender* sender, | 134 InputRouterImpl::InputRouterImpl(IPC::Sender* sender, |
| 121 InputRouterClient* client, | 135 InputRouterClient* client, |
| 122 InputAckHandler* ack_handler, | 136 InputAckHandler* ack_handler, |
| 123 int routing_id) | 137 int routing_id) |
| 124 : sender_(sender), | 138 : sender_(sender), |
| 125 client_(client), | 139 client_(client), |
| 126 ack_handler_(ack_handler), | 140 ack_handler_(ack_handler), |
| 127 routing_id_(routing_id), | 141 routing_id_(routing_id), |
| 128 select_range_pending_(false), | 142 select_range_pending_(false), |
| 129 move_caret_pending_(false), | 143 move_caret_pending_(false), |
| 130 mouse_move_pending_(false), | 144 mouse_move_pending_(false), |
| 131 mouse_wheel_pending_(false), | 145 mouse_wheel_pending_(false), |
| 132 touch_ack_timeout_enabled_(false), | 146 touch_ack_timeout_enabled_(false), |
| 133 touch_ack_timeout_delay_ms_(std::numeric_limits<size_t>::max()), | 147 touch_ack_timeout_delay_ms_(std::numeric_limits<size_t>::max()), |
| 134 current_ack_source_(ACK_SOURCE_NONE), | 148 current_ack_source_(ACK_SOURCE_NONE), |
| 135 gesture_event_queue_(new GestureEventQueue(this, this)) { | 149 gesture_event_queue_(new GestureEventQueue(this, this)) { |
| 136 DCHECK(sender); | 150 DCHECK(sender); |
| 137 DCHECK(client); | 151 DCHECK(client); |
| 138 DCHECK(ack_handler); | 152 DCHECK(ack_handler); |
| 139 touch_event_queue_.reset( | 153 touch_event_queue_.reset(new TouchEventQueue( |
| 140 new TouchEventQueue(this, GetTouchMoveSlopSuppressionLengthDips())); | 154 this, GetTouchScrollingMode(), GetTouchMoveSlopSuppressionLengthDips())); |
| 141 touch_ack_timeout_enabled_ = | 155 touch_ack_timeout_enabled_ = |
| 142 GetTouchAckTimeoutDelayMs(&touch_ack_timeout_delay_ms_); | 156 GetTouchAckTimeoutDelayMs(&touch_ack_timeout_delay_ms_); |
| 143 touch_event_queue_->SetAckTimeoutEnabled(touch_ack_timeout_enabled_, | 157 touch_event_queue_->SetAckTimeoutEnabled(touch_ack_timeout_enabled_, |
| 144 touch_ack_timeout_delay_ms_); | 158 touch_ack_timeout_delay_ms_); |
| 145 } | 159 } |
| 146 | 160 |
| 147 InputRouterImpl::~InputRouterImpl() {} | 161 InputRouterImpl::~InputRouterImpl() {} |
| 148 | 162 |
| 149 void InputRouterImpl::Flush() {} | 163 void InputRouterImpl::Flush() {} |
| 150 | 164 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 } | 335 } |
| 322 | 336 |
| 323 void InputRouterImpl::OnTouchEventAck(const TouchEventWithLatencyInfo& event, | 337 void InputRouterImpl::OnTouchEventAck(const TouchEventWithLatencyInfo& event, |
| 324 InputEventAckState ack_result) { | 338 InputEventAckState ack_result) { |
| 325 ack_handler_->OnTouchEventAck(event, ack_result); | 339 ack_handler_->OnTouchEventAck(event, ack_result); |
| 326 } | 340 } |
| 327 | 341 |
| 328 void InputRouterImpl::OnGestureEventAck( | 342 void InputRouterImpl::OnGestureEventAck( |
| 329 const GestureEventWithLatencyInfo& event, | 343 const GestureEventWithLatencyInfo& event, |
| 330 InputEventAckState ack_result) { | 344 InputEventAckState ack_result) { |
| 345 touch_event_queue_->OnGestureEventAck(event, ack_result); | |
| 331 ProcessAckForOverscroll(event.event, ack_result); | 346 ProcessAckForOverscroll(event.event, ack_result); |
| 332 ack_handler_->OnGestureEventAck(event, ack_result); | 347 ack_handler_->OnGestureEventAck(event, ack_result); |
| 333 } | 348 } |
| 334 | 349 |
| 335 bool InputRouterImpl::SendSelectRange(scoped_ptr<IPC::Message> message) { | 350 bool InputRouterImpl::SendSelectRange(scoped_ptr<IPC::Message> message) { |
| 336 DCHECK(message->type() == InputMsg_SelectRange::ID); | 351 DCHECK(message->type() == InputMsg_SelectRange::ID); |
| 337 if (select_range_pending_) { | 352 if (select_range_pending_) { |
| 338 next_selection_range_ = message.Pass(); | 353 next_selection_range_ = message.Pass(); |
| 339 return true; | 354 return true; |
| 340 } | 355 } |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 break; | 764 break; |
| 750 } | 765 } |
| 751 } | 766 } |
| 752 | 767 |
| 753 bool InputRouterImpl::IsInOverscrollGesture() const { | 768 bool InputRouterImpl::IsInOverscrollGesture() const { |
| 754 OverscrollController* controller = client_->GetOverscrollController(); | 769 OverscrollController* controller = client_->GetOverscrollController(); |
| 755 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; | 770 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; |
| 756 } | 771 } |
| 757 | 772 |
| 758 } // namespace content | 773 } // namespace content |
| OLD | NEW |