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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 void InputRouterImpl::SendKeyboardEvent(const NativeWebKeyboardEvent& key_event, | 184 void InputRouterImpl::SendKeyboardEvent(const NativeWebKeyboardEvent& key_event, |
185 const ui::LatencyInfo& latency_info, | 185 const ui::LatencyInfo& latency_info, |
186 bool is_keyboard_shortcut) { | 186 bool is_keyboard_shortcut) { |
187 // Put all WebKeyboardEvent objects in a queue since we can't trust the | 187 // Put all WebKeyboardEvent objects in a queue since we can't trust the |
188 // renderer and we need to give something to the HandleKeyboardEvent | 188 // renderer and we need to give something to the HandleKeyboardEvent |
189 // handler. | 189 // handler. |
190 key_queue_.push_back(key_event); | 190 key_queue_.push_back(key_event); |
191 HISTOGRAM_COUNTS_100("Renderer.KeyboardQueueSize", key_queue_.size()); | 191 HISTOGRAM_COUNTS_100("Renderer.KeyboardQueueSize", key_queue_.size()); |
192 | 192 |
193 gesture_event_filter_->FlingHasBeenHalted(); | |
194 | |
195 // Only forward the non-native portions of our event. | 193 // Only forward the non-native portions of our event. |
196 FilterAndSendWebInputEvent(key_event, latency_info, is_keyboard_shortcut); | 194 FilterAndSendWebInputEvent(key_event, latency_info, is_keyboard_shortcut); |
197 } | 195 } |
198 | 196 |
199 void InputRouterImpl::SendGestureEvent( | 197 void InputRouterImpl::SendGestureEvent( |
200 const GestureEventWithLatencyInfo& original_gesture_event) { | 198 const GestureEventWithLatencyInfo& original_gesture_event) { |
201 GestureEventWithLatencyInfo gesture_event(original_gesture_event); | 199 GestureEventWithLatencyInfo gesture_event(original_gesture_event); |
202 if (touch_action_filter_.FilterGestureEvent(&gesture_event.event)) | 200 if (touch_action_filter_.FilterGestureEvent(&gesture_event.event)) |
203 return; | 201 return; |
204 | 202 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 265 } |
268 | 266 |
269 void InputRouterImpl::OnViewUpdated(int view_flags) { | 267 void InputRouterImpl::OnViewUpdated(int view_flags) { |
270 bool fixed_page_scale = (view_flags & FIXED_PAGE_SCALE) != 0; | 268 bool fixed_page_scale = (view_flags & FIXED_PAGE_SCALE) != 0; |
271 bool mobile_viewport = (view_flags & MOBILE_VIEWPORT) != 0; | 269 bool mobile_viewport = (view_flags & MOBILE_VIEWPORT) != 0; |
272 touch_event_queue_->SetAckTimeoutEnabled( | 270 touch_event_queue_->SetAckTimeoutEnabled( |
273 touch_ack_timeout_enabled_ && !(fixed_page_scale || mobile_viewport), | 271 touch_ack_timeout_enabled_ && !(fixed_page_scale || mobile_viewport), |
274 touch_ack_timeout_delay_ms_); | 272 touch_ack_timeout_delay_ms_); |
275 } | 273 } |
276 | 274 |
| 275 void InputRouterImpl::DidStopFlinging() { |
| 276 gesture_event_filter_->DidStopFlinging(); |
| 277 } |
| 278 |
277 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { | 279 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { |
278 bool handled = true; | 280 bool handled = true; |
279 bool message_is_ok = true; | 281 bool message_is_ok = true; |
280 IPC_BEGIN_MESSAGE_MAP_EX(InputRouterImpl, message, message_is_ok) | 282 IPC_BEGIN_MESSAGE_MAP_EX(InputRouterImpl, message, message_is_ok) |
281 IPC_MESSAGE_HANDLER(InputHostMsg_HandleInputEvent_ACK, OnInputEventAck) | 283 IPC_MESSAGE_HANDLER(InputHostMsg_HandleInputEvent_ACK, OnInputEventAck) |
282 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck) | 284 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck) |
283 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck) | 285 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck) |
284 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, | 286 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, |
285 OnHasTouchEventHandlers) | 287 OnHasTouchEventHandlers) |
286 IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction, | 288 IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction, |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 break; | 726 break; |
725 } | 727 } |
726 } | 728 } |
727 | 729 |
728 bool InputRouterImpl::IsInOverscrollGesture() const { | 730 bool InputRouterImpl::IsInOverscrollGesture() const { |
729 OverscrollController* controller = client_->GetOverscrollController(); | 731 OverscrollController* controller = client_->GetOverscrollController(); |
730 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; | 732 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; |
731 } | 733 } |
732 | 734 |
733 } // namespace content | 735 } // namespace content |
OLD | NEW |