Chromium Code Reviews| Index: content/browser/renderer_host/input/input_router_impl.cc |
| diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc |
| index 83f6fcb164f066646547a34903fa98d2e0f8e787..ee3bdfcf36e716e2c4196642631023fdb8ab0174 100644 |
| --- a/content/browser/renderer_host/input/input_router_impl.cc |
| +++ b/content/browser/renderer_host/input/input_router_impl.cc |
| @@ -29,13 +29,6 @@ |
| #include "ui/events/event.h" |
| #include "ui/events/keycodes/keyboard_codes.h" |
| -#if defined(OS_ANDROID) |
| -#include "ui/gfx/android/view_configuration.h" |
| -#include "ui/gfx/screen.h" |
| -#else |
| -#include "ui/events/gestures/gesture_configuration.h" |
| -#endif |
| - |
| using base::Time; |
| using base::TimeDelta; |
| using base::TimeTicks; |
| @@ -48,55 +41,22 @@ using blink::WebMouseWheelEvent; |
| namespace content { |
| namespace { |
| -// TODO(jdduke): Instead of relying on command line flags or conditional |
| -// conditional compilation here, we should instead use an InputRouter::Settings |
| -// construct, supplied and customized by the RenderWidgetHostView. See |
| -// crbug.com/343917. |
| -bool GetTouchAckTimeoutDelay(base::TimeDelta* touch_ack_timeout_delay) { |
| - CommandLine* parsed_command_line = CommandLine::ForCurrentProcess(); |
| - if (!parsed_command_line->HasSwitch(switches::kTouchAckTimeoutDelayMs)) |
| - return false; |
| - |
| - std::string timeout_string = parsed_command_line->GetSwitchValueASCII( |
| - switches::kTouchAckTimeoutDelayMs); |
| - size_t timeout_ms; |
| - if (!base::StringToSizeT(timeout_string, &timeout_ms)) |
| - return false; |
| +GestureEventWithLatencyInfo MakeGestureEvent(WebInputEvent::Type type, |
|
tdresser
2014/05/01 13:51:56
Is this ever used?
jdduke (slow)
2014/05/01 16:44:25
Hmm, it appears not, I believe it was leftover fro
|
| + double timestamp_seconds, |
| + int x, |
| + int y, |
| + int modifiers, |
| + const ui::LatencyInfo& latency) { |
| + WebGestureEvent result; |
| - *touch_ack_timeout_delay = base::TimeDelta::FromMilliseconds(timeout_ms); |
| - return true; |
| -} |
| - |
| -#if defined(OS_ANDROID) |
| -double GetTouchMoveSlopSuppressionLengthDips() { |
| - const double touch_slop_length_pixels = |
| - static_cast<double>(gfx::ViewConfiguration::GetTouchSlopInPixels()); |
| - const double device_scale_factor = |
| - gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor(); |
| - return touch_slop_length_pixels / device_scale_factor; |
| -} |
| -#elif defined(USE_AURA) |
| -double GetTouchMoveSlopSuppressionLengthDips() { |
| - return ui::GestureConfiguration::max_touch_move_in_pixels_for_click(); |
| -} |
| -#else |
| -double GetTouchMoveSlopSuppressionLengthDips() { |
| - return 0; |
| -} |
| -#endif |
| + result.type = type; |
| + result.x = x; |
| + result.y = y; |
| + result.sourceDevice = WebGestureEvent::Touchscreen; |
| + result.timeStampSeconds = timestamp_seconds; |
| + result.modifiers = modifiers; |
| -TouchEventQueue::TouchScrollingMode GetTouchScrollingMode() { |
| - std::string modeString = CommandLine::ForCurrentProcess()-> |
| - GetSwitchValueASCII(switches::kTouchScrollingMode); |
| - if (modeString == switches::kTouchScrollingModeAsyncTouchmove) |
| - return TouchEventQueue::TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE; |
| - if (modeString == switches::kTouchScrollingModeSyncTouchmove) |
| - return TouchEventQueue::TOUCH_SCROLLING_MODE_SYNC_TOUCHMOVE; |
| - if (modeString == switches::kTouchScrollingModeTouchcancel) |
| - return TouchEventQueue::TOUCH_SCROLLING_MODE_TOUCHCANCEL; |
| - if (modeString != "") |
| - LOG(ERROR) << "Invalid --touch-scrolling-mode option: " << modeString; |
| - return TouchEventQueue::TOUCH_SCROLLING_MODE_DEFAULT; |
| + return GestureEventWithLatencyInfo(result, latency); |
| } |
| const char* GetEventAckName(InputEventAckState ack_result) { |
| @@ -113,10 +73,14 @@ const char* GetEventAckName(InputEventAckState ack_result) { |
| } // namespace |
| +InputRouterImpl::Config::Config() { |
| +} |
| + |
| InputRouterImpl::InputRouterImpl(IPC::Sender* sender, |
| InputRouterClient* client, |
| InputAckHandler* ack_handler, |
| - int routing_id) |
| + int routing_id, |
| + const Config& config) |
| : sender_(sender), |
| client_(client), |
| ack_handler_(ack_handler), |
| @@ -125,19 +89,14 @@ InputRouterImpl::InputRouterImpl(IPC::Sender* sender, |
| move_caret_pending_(false), |
| mouse_move_pending_(false), |
| mouse_wheel_pending_(false), |
| - touch_ack_timeout_supported_(false), |
| current_view_flags_(0), |
| current_ack_source_(ACK_SOURCE_NONE), |
| flush_requested_(false), |
| - touch_event_queue_(this, |
| - GetTouchScrollingMode(), |
| - GetTouchMoveSlopSuppressionLengthDips()), |
| - gesture_event_queue_(this, this) { |
| + touch_event_queue_(this, config.touch_config), |
| + gesture_event_queue_(this, this, config.gesture_config) { |
| DCHECK(sender); |
| DCHECK(client); |
| DCHECK(ack_handler); |
| - touch_ack_timeout_supported_ = |
| - GetTouchAckTimeoutDelay(&touch_ack_timeout_delay_); |
| UpdateTouchAckTimeoutEnabled(); |
| } |
| @@ -703,11 +662,6 @@ void InputRouterImpl::ProcessAckForOverscroll(const WebInputEvent& event, |
| } |
| void InputRouterImpl::UpdateTouchAckTimeoutEnabled() { |
| - if (!touch_ack_timeout_supported_) { |
| - touch_event_queue_.SetAckTimeoutEnabled(false, base::TimeDelta()); |
| - return; |
| - } |
| - |
| // Mobile sites tend to be well-behaved with respect to touch handling, so |
| // they have less need for the touch timeout fallback. |
| const bool fixed_page_scale = (current_view_flags_ & FIXED_PAGE_SCALE) != 0; |
| @@ -722,8 +676,7 @@ void InputRouterImpl::UpdateTouchAckTimeoutEnabled() { |
| const bool touch_ack_timeout_enabled = !fixed_page_scale && |
| !mobile_viewport && |
| !touch_action_none; |
| - touch_event_queue_.SetAckTimeoutEnabled(touch_ack_timeout_enabled, |
| - touch_ack_timeout_delay_); |
| + touch_event_queue_.SetAckTimeoutEnabled(touch_ack_timeout_enabled); |
| } |
| void InputRouterImpl::SignalFlushedIfNecessary() { |