| Index: content/browser/renderer_host/input/immediate_input_router.cc
|
| diff --git a/content/browser/renderer_host/input/immediate_input_router.cc b/content/browser/renderer_host/input/immediate_input_router.cc
|
| index 3b6e88bf79675962fd42786ea24269c7f7eede5e..cc488ef3b6c19aa005ac123425b7d37c6ac85cd1 100644
|
| --- a/content/browser/renderer_host/input/immediate_input_router.cc
|
| +++ b/content/browser/renderer_host/input/immediate_input_router.cc
|
| @@ -7,11 +7,10 @@
|
| #include "base/auto_reset.h"
|
| #include "base/command_line.h"
|
| #include "base/metrics/histogram.h"
|
| -#include "content/browser/renderer_host/input/gesture_event_filter.h"
|
| +#include "content/browser/renderer_host/input/base_gesture_event_filter.h"
|
| #include "content/browser/renderer_host/input/input_ack_handler.h"
|
| #include "content/browser/renderer_host/input/input_router_client.h"
|
| #include "content/browser/renderer_host/input/touch_event_queue.h"
|
| -#include "content/browser/renderer_host/input/touchpad_tap_suppression_controller.h"
|
| #include "content/browser/renderer_host/overscroll_controller.h"
|
| #include "content/common/content_constants_internal.h"
|
| #include "content/common/edit_command.h"
|
| @@ -70,73 +69,8 @@ const char* GetEventAckName(InputEventAckState ack_result) {
|
| return "";
|
| }
|
|
|
| -bool BrowserSideFlingEnabled() {
|
| - return CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kEnableBrowserSideFling);
|
| -}
|
| -
|
| } // namespace
|
|
|
| -// A helper class that based on the value of the |kEnableBrowserSideFling| flag
|
| -// does event filtering using either |BaseGestureEventFilter| or
|
| -// |GestureEventFilter|.
|
| -class ImmediateInputRouter::EventFilteringHelper {
|
| - public:
|
| - // |router| must outlive us.
|
| - explicit EventFilteringHelper(ImmediateInputRouter* router) {
|
| - if (BrowserSideFlingEnabled())
|
| - gesture_event_filter_.reset(new BaseGestureEventFilter(router));
|
| - else
|
| - gesture_event_filter_.reset(new GestureEventFilter(router, router));
|
| - }
|
| - virtual ~EventFilteringHelper() {}
|
| -
|
| - bool ShouldDeferMouseDown(const MouseEventWithLatencyInfo& mouse_event) {
|
| - if (BrowserSideFlingEnabled())
|
| - return false;
|
| -
|
| - return static_cast<GestureEventFilter*>(gesture_event_filter_.get())->
|
| - GetTouchpadTapSuppressionController()->ShouldDeferMouseDown(
|
| - mouse_event);
|
| - }
|
| -
|
| - bool ShouldDeferMouseUp(const MouseEventWithLatencyInfo& mouse_event) {
|
| - if (BrowserSideFlingEnabled())
|
| - return false;
|
| -
|
| - return static_cast<GestureEventFilter*>(gesture_event_filter_.get())->
|
| - GetTouchpadTapSuppressionController()->ShouldSuppressMouseUp();
|
| - }
|
| -
|
| - void FlingHasBeenHalted() {
|
| - if (BrowserSideFlingEnabled())
|
| - return;
|
| -
|
| - static_cast<GestureEventFilter*>(gesture_event_filter_.get())->
|
| - FlingHasBeenHalted();
|
| - }
|
| -
|
| - bool ShouldForwardGesture(const GestureEventWithLatencyInfo& gesture_event) {
|
| - return gesture_event_filter_->ShouldForward(gesture_event);
|
| - }
|
| -
|
| - bool HasQueuedGestureEvents() {
|
| - return gesture_event_filter_->HasQueuedGestureEvents();
|
| - }
|
| -
|
| - void ProcessGestureAck(InputEventAckState ack_result,
|
| - WebKit::WebInputEvent::Type type,
|
| - const ui::LatencyInfo& latency) {
|
| - gesture_event_filter_->ProcessGestureAck(ack_result, type, latency);
|
| - }
|
| -
|
| - private:
|
| - friend class ImmediateInputRouter;
|
| - scoped_ptr<BaseGestureEventFilter> gesture_event_filter_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(EventFilteringHelper);
|
| -};
|
| -
|
| ImmediateInputRouter::ImmediateInputRouter(IPC::Sender* sender,
|
| InputRouterClient* client,
|
| InputAckHandler* ack_handler,
|
| @@ -153,7 +87,7 @@ ImmediateInputRouter::ImmediateInputRouter(IPC::Sender* sender,
|
| current_ack_source_(ACK_SOURCE_NONE),
|
| touch_event_queue_(new TouchEventQueue(this)),
|
| flinger_(new Flinger(this)),
|
| - event_filter_(new EventFilteringHelper(this)) {
|
| + event_filter_(new BaseGestureEventFilter(this)) {
|
| DCHECK(sender);
|
| DCHECK(client);
|
| DCHECK(ack_handler);
|
| @@ -185,29 +119,22 @@ bool ImmediateInputRouter::SendInput(scoped_ptr<IPC::Message> message) {
|
| void ImmediateInputRouter::SendMouseEvent(
|
| const MouseEventWithLatencyInfo& mouse_event) {
|
| // Order is important here; we need to convert all MouseEvents before they
|
| - // propagate further, e.g., to the tap suppression controller.
|
| + // propagate further.
|
| if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| switches::kSimulateTouchScreenWithMouse)) {
|
| SimulateTouchGestureWithMouse(mouse_event);
|
| return;
|
| }
|
|
|
| - if (BrowserSideFlingEnabled() && flinger_->HandleMouseEvent(mouse_event))
|
| + if (flinger_->HandleMouseEvent(mouse_event))
|
| return;
|
|
|
| - if (mouse_event.event.type == WebInputEvent::MouseDown &&
|
| - event_filter_->ShouldDeferMouseDown(mouse_event))
|
| - return;
|
| - if (mouse_event.event.type == WebInputEvent::MouseUp &&
|
| - event_filter_->ShouldDeferMouseUp(mouse_event))
|
| - return;
|
| -
|
| SendMouseEventImmediately(mouse_event);
|
| }
|
|
|
| void ImmediateInputRouter::SendWheelEvent(
|
| const MouseWheelEventWithLatencyInfo& wheel_event) {
|
| - if (BrowserSideFlingEnabled() && flinger_->HandleWheelEvent(wheel_event))
|
| + if (flinger_->HandleWheelEvent(wheel_event))
|
| return;
|
|
|
| // If there's already a mouse wheel event waiting to be sent to the renderer,
|
| @@ -236,7 +163,7 @@ void ImmediateInputRouter::SendKeyboardEvent(
|
| const NativeWebKeyboardEvent& key_event,
|
| const ui::LatencyInfo& latency_info,
|
| bool is_keyboard_shortcut) {
|
| - if (BrowserSideFlingEnabled() && flinger_->HandleKeyboardEvent())
|
| + if (flinger_->HandleKeyboardEvent())
|
| return;
|
|
|
| // Put all WebKeyboardEvent objects in a queue since we can't trust the
|
| @@ -245,8 +172,6 @@ void ImmediateInputRouter::SendKeyboardEvent(
|
| key_queue_.push_back(key_event);
|
| HISTOGRAM_COUNTS_100("Renderer.KeyboardQueueSize", key_queue_.size());
|
|
|
| - event_filter_->FlingHasBeenHalted();
|
| -
|
| // Only forward the non-native portions of our event.
|
| FilterAndSendWebInputEvent(key_event, latency_info, is_keyboard_shortcut);
|
| }
|
| @@ -255,11 +180,11 @@ void ImmediateInputRouter::SendGestureEvent(
|
| const GestureEventWithLatencyInfo& gesture_event) {
|
| HandleGestureScroll(gesture_event);
|
|
|
| - if (BrowserSideFlingEnabled() && flinger_->HandleGestureEvent(gesture_event))
|
| + if (flinger_->HandleGestureEvent(gesture_event))
|
| return;
|
|
|
| if (!IsInOverscrollGesture() &&
|
| - !event_filter_->ShouldForwardGesture(gesture_event)) {
|
| + !event_filter_->ShouldForward(gesture_event)) {
|
| OverscrollController* controller = client_->GetOverscrollController();
|
| if (controller)
|
| controller->DiscardingGestureEvent(gesture_event.event);
|
| @@ -274,8 +199,6 @@ void ImmediateInputRouter::SendTouchEvent(
|
| touch_event_queue_->QueueEvent(touch_event);
|
| }
|
|
|
| -// Forwards MouseEvent without passing it through
|
| -// TouchpadTapSuppressionController.
|
| void ImmediateInputRouter::SendMouseEventImmediately(
|
| const MouseEventWithLatencyInfo& mouse_event) {
|
| // Avoid spamming the renderer with mouse move events. It is important
|
| @@ -458,7 +381,7 @@ bool ImmediateInputRouter::OfferToOverscrollController(
|
| const WebKit::WebGestureEvent& gesture_event =
|
| static_cast<const WebKit::WebGestureEvent&>(input_event);
|
| // An ACK is expected for the event, so mark it as consumed.
|
| - consumed = !event_filter_->ShouldForwardGesture(
|
| + consumed = !event_filter_->ShouldForward(
|
| GestureEventWithLatencyInfo(gesture_event, latency_info));
|
| }
|
|
|
| @@ -776,8 +699,4 @@ bool ImmediateInputRouter::IsInOverscrollGesture() const {
|
| return controller && controller->overscroll_mode() != OVERSCROLL_NONE;
|
| }
|
|
|
| -BaseGestureEventFilter* ImmediateInputRouter::gesture_event_filter() {
|
| - return event_filter_->gesture_event_filter_.get();
|
| -}
|
| -
|
| } // namespace content
|
|
|