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" |
| 11 #include "content/browser/renderer_host/input/gesture_event_queue.h" | 11 #include "content/browser/renderer_host/input/gesture_event_queue.h" |
| 12 #include "content/browser/renderer_host/input/input_ack_handler.h" | 12 #include "content/browser/renderer_host/input/input_ack_handler.h" |
| 13 #include "content/browser/renderer_host/input/input_router_client.h" | 13 #include "content/browser/renderer_host/input/input_router_client.h" |
| 14 #include "content/browser/renderer_host/input/touch_event_queue.h" | 14 #include "content/browser/renderer_host/input/touch_event_queue.h" |
| 15 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" | 15 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" |
| 16 #include "content/browser/renderer_host/input/web_touch_event_traits.h" | |
| 17 #include "content/browser/renderer_host/overscroll_controller.h" | 16 #include "content/browser/renderer_host/overscroll_controller.h" |
| 18 #include "content/common/content_constants_internal.h" | 17 #include "content/common/content_constants_internal.h" |
| 19 #include "content/common/edit_command.h" | 18 #include "content/common/edit_command.h" |
| 20 #include "content/common/input/touch_action.h" | 19 #include "content/common/input/touch_action.h" |
| 20 #include "content/common/input/web_touch_event_traits.h" | |
| 21 #include "content/common/input_messages.h" | 21 #include "content/common/input_messages.h" |
| 22 #include "content/common/view_messages.h" | 22 #include "content/common/view_messages.h" |
| 23 #include "content/port/common/input_event_ack_state.h" | 23 #include "content/port/common/input_event_ack_state.h" |
| 24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 25 #include "content/public/browser/notification_types.h" | 25 #include "content/public/browser/notification_types.h" |
| 26 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "ipc/ipc_sender.h" | 28 #include "ipc/ipc_sender.h" |
| 29 #include "ui/events/event.h" | 29 #include "ui/events/event.h" |
| 30 #include "ui/events/keycodes/keyboard_codes.h" | 30 #include "ui/events/keycodes/keyboard_codes.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 } | 439 } |
| 440 | 440 |
| 441 if (OfferToOverscrollController(input_event, latency_info)) | 441 if (OfferToOverscrollController(input_event, latency_info)) |
| 442 return; | 442 return; |
| 443 | 443 |
| 444 if (OfferToClient(input_event, latency_info)) | 444 if (OfferToClient(input_event, latency_info)) |
| 445 return; | 445 return; |
| 446 | 446 |
| 447 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); | 447 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); |
| 448 | 448 |
| 449 // Touch events should always indicate in the event whether they are | |
| 450 // cancelable (respect ACK disposition) or not. | |
| 451 bool ignoresAck = | |
| 452 WebInputEventTraits::IgnoresAckDisposition(input_event.type); | |
| 453 if (WebInputEvent::isTouchEventType(input_event.type)) { | |
| 454 DCHECK(!ignoresAck == | |
| 455 static_cast<const blink::WebTouchEvent&>(input_event).cancelable); | |
| 456 } | |
| 457 | |
| 449 // If we don't care about the ack disposition, send the ack immediately. | 458 // If we don't care about the ack disposition, send the ack immediately. |
| 450 if (WebInputEventTraits::IgnoresAckDisposition(input_event.type)) { | 459 if (ignoresAck) { |
| 451 ProcessInputEventAck(input_event.type, | 460 ProcessInputEventAck(input_event.type, |
|
jdduke (slow)
2014/04/23 21:55:47
Let's put the DCHECK inside this block (for the to
Rick Byers
2014/04/23 23:15:35
But I also want to DCHECK the other case as well -
jdduke (slow)
2014/04/23 23:29:49
Well, I was thinking of the impending case where o
| |
| 452 INPUT_EVENT_ACK_STATE_IGNORED, | 461 INPUT_EVENT_ACK_STATE_IGNORED, |
| 453 latency_info, | 462 latency_info, |
| 454 IGNORING_DISPOSITION); | 463 IGNORING_DISPOSITION); |
| 455 } | 464 } |
| 456 } | 465 } |
| 457 | 466 |
| 458 bool InputRouterImpl::OfferToOverscrollController( | 467 bool InputRouterImpl::OfferToOverscrollController( |
| 459 const WebInputEvent& input_event, | 468 const WebInputEvent& input_event, |
| 460 const ui::LatencyInfo& latency_info) { | 469 const ui::LatencyInfo& latency_info) { |
| 461 OverscrollController* controller = client_->GetOverscrollController(); | 470 OverscrollController* controller = client_->GetOverscrollController(); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 849 select_range_pending_ || | 858 select_range_pending_ || |
| 850 move_caret_pending_; | 859 move_caret_pending_; |
| 851 } | 860 } |
| 852 | 861 |
| 853 bool InputRouterImpl::IsInOverscrollGesture() const { | 862 bool InputRouterImpl::IsInOverscrollGesture() const { |
| 854 OverscrollController* controller = client_->GetOverscrollController(); | 863 OverscrollController* controller = client_->GetOverscrollController(); |
| 855 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; | 864 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; |
| 856 } | 865 } |
| 857 | 866 |
| 858 } // namespace content | 867 } // namespace content |
| OLD | NEW |