| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 ProcessInputEventAck(input_event.type, | 417 ProcessInputEventAck(input_event.type, |
| 418 INPUT_EVENT_ACK_STATE_IGNORED, | 418 INPUT_EVENT_ACK_STATE_IGNORED, |
| 419 latency_info, | 419 latency_info, |
| 420 IGNORING_DISPOSITION); | 420 IGNORING_DISPOSITION); |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 | 423 |
| 424 bool InputRouterImpl::OfferToOverscrollController( | 424 bool InputRouterImpl::OfferToOverscrollController( |
| 425 const WebInputEvent& input_event, | 425 const WebInputEvent& input_event, |
| 426 const ui::LatencyInfo& latency_info) { | 426 const ui::LatencyInfo& latency_info) { |
| 427 #if !defined(OS_MACOSX) |
| 428 // Ctrl + mousewheel is reserved for zooming on every platform except for Mac. |
| 429 if (input_event.type == WebInputEvent::MouseWheel && |
| 430 input_event.modifiers & WebInputEvent::ControlKey) |
| 431 return false; |
| 432 #endif |
| 433 |
| 427 OverscrollController* controller = client_->GetOverscrollController(); | 434 OverscrollController* controller = client_->GetOverscrollController(); |
| 428 if (!controller) | 435 if (!controller) |
| 429 return false; | 436 return false; |
| 430 | 437 |
| 431 OverscrollController::Disposition disposition = | 438 OverscrollController::Disposition disposition = |
| 432 controller->DispatchEvent(input_event, latency_info); | 439 controller->DispatchEvent(input_event, latency_info); |
| 433 | 440 |
| 434 bool consumed = disposition == OverscrollController::CONSUMED; | 441 bool consumed = disposition == OverscrollController::CONSUMED; |
| 435 | 442 |
| 436 if (disposition == OverscrollController::SHOULD_FORWARD_TO_GESTURE_QUEUE) { | 443 if (disposition == OverscrollController::SHOULD_FORWARD_TO_GESTURE_QUEUE) { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 if (next_mouse_move_) { | 630 if (next_mouse_move_) { |
| 624 DCHECK(next_mouse_move_->event.type == WebInputEvent::MouseMove); | 631 DCHECK(next_mouse_move_->event.type == WebInputEvent::MouseMove); |
| 625 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move | 632 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move |
| 626 = next_mouse_move_.Pass(); | 633 = next_mouse_move_.Pass(); |
| 627 SendMouseEvent(*next_mouse_move); | 634 SendMouseEvent(*next_mouse_move); |
| 628 } | 635 } |
| 629 } | 636 } |
| 630 | 637 |
| 631 void InputRouterImpl::ProcessWheelAck(InputEventAckState ack_result, | 638 void InputRouterImpl::ProcessWheelAck(InputEventAckState ack_result, |
| 632 const ui::LatencyInfo& latency) { | 639 const ui::LatencyInfo& latency) { |
| 640 #if defined(OS_MACOSX) |
| 633 ProcessAckForOverscroll(current_wheel_event_.event, ack_result); | 641 ProcessAckForOverscroll(current_wheel_event_.event, ack_result); |
| 642 #else |
| 643 // Ctrl + mousewheel is reserved for zooming on every platform except for Mac. |
| 644 if (!(current_wheel_event_.event.modifiers & WebInputEvent::ControlKey)) { |
| 645 ProcessAckForOverscroll(current_wheel_event_.event, ack_result); |
| 646 } |
| 647 #endif |
| 634 | 648 |
| 635 // TODO(miletus): Add renderer side latency to each uncoalesced mouse | 649 // TODO(miletus): Add renderer side latency to each uncoalesced mouse |
| 636 // wheel event and add terminal component to each of them. | 650 // wheel event and add terminal component to each of them. |
| 637 current_wheel_event_.latency.AddNewLatencyFrom(latency); | 651 current_wheel_event_.latency.AddNewLatencyFrom(latency); |
| 638 // Process the unhandled wheel event here before calling SendWheelEvent() | 652 // Process the unhandled wheel event here before calling SendWheelEvent() |
| 639 // since it will mutate current_wheel_event_. | 653 // since it will mutate current_wheel_event_. |
| 640 ack_handler_->OnWheelEventAck(current_wheel_event_, ack_result); | 654 ack_handler_->OnWheelEventAck(current_wheel_event_, ack_result); |
| 641 mouse_wheel_pending_ = false; | 655 mouse_wheel_pending_ = false; |
| 642 | 656 |
| 643 // Now send the next (coalesced) mouse wheel event. | 657 // Now send the next (coalesced) mouse wheel event. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 break; | 778 break; |
| 765 } | 779 } |
| 766 } | 780 } |
| 767 | 781 |
| 768 bool InputRouterImpl::IsInOverscrollGesture() const { | 782 bool InputRouterImpl::IsInOverscrollGesture() const { |
| 769 OverscrollController* controller = client_->GetOverscrollController(); | 783 OverscrollController* controller = client_->GetOverscrollController(); |
| 770 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; | 784 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; |
| 771 } | 785 } |
| 772 | 786 |
| 773 } // namespace content | 787 } // namespace content |
| OLD | NEW |