Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 217253002: [Android] Short-circuit touch forwarding when no touch handlers exist (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency, false); 304 FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency, false);
305 } 305 }
306 306
307 const NativeWebKeyboardEvent* InputRouterImpl::GetLastKeyboardEvent() const { 307 const NativeWebKeyboardEvent* InputRouterImpl::GetLastKeyboardEvent() const {
308 if (key_queue_.empty()) 308 if (key_queue_.empty())
309 return NULL; 309 return NULL;
310 return &key_queue_.front(); 310 return &key_queue_.front();
311 } 311 }
312 312
313 bool InputRouterImpl::ShouldForwardTouchEvent() const { 313 bool InputRouterImpl::ShouldForwardTouchEvent() const {
314 // Always send a touch event if the renderer has a touch-event handler. 314 // Always send a touch event if the renderer has a touch-event handler or
315 return touch_event_queue_->has_handlers(); 315 // there are pending touch events.
316 return touch_event_queue_->has_handlers() || !touch_event_queue_->empty();
316 } 317 }
317 318
318 void InputRouterImpl::OnViewUpdated(int view_flags) { 319 void InputRouterImpl::OnViewUpdated(int view_flags) {
319 current_view_flags_ = view_flags; 320 current_view_flags_ = view_flags;
320 321
321 // A fixed page scale or mobile viewport should disable the touch ack timeout. 322 // A fixed page scale or mobile viewport should disable the touch ack timeout.
322 UpdateTouchAckTimeoutEnabled(); 323 UpdateTouchAckTimeoutEnabled();
323 } 324 }
324 325
325 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { 326 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) {
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 touch_event_queue_->SetAckTimeoutEnabled(touch_ack_timeout_enabled, 808 touch_event_queue_->SetAckTimeoutEnabled(touch_ack_timeout_enabled,
808 touch_ack_timeout_delay_); 809 touch_ack_timeout_delay_);
809 } 810 }
810 811
811 bool InputRouterImpl::IsInOverscrollGesture() const { 812 bool InputRouterImpl::IsInOverscrollGesture() const {
812 OverscrollController* controller = client_->GetOverscrollController(); 813 OverscrollController* controller = client_->GetOverscrollController();
813 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; 814 return controller && controller->overscroll_mode() != OVERSCROLL_NONE;
814 } 815 }
815 816
816 } // namespace content 817 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698