| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_config_helper.h" | 5 #include "content/browser/renderer_host/input/input_router_config_helper.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/feature_list.h" |
| 8 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "content/public/common/content_features.h" |
| 9 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 10 #include "ui/events/gesture_detection/gesture_configuration.h" | 12 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 11 #include "ui/events/gesture_detection/gesture_detector.h" | 13 #include "ui/events/gesture_detection/gesture_detector.h" |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 // Default time allowance for the touch ack delay before the touch sequence is | 18 // Default time allowance for the touch ack delay before the touch sequence is |
| 17 // cancelled, depending on whether the site has a mobile-friendly viewport. | 19 // cancelled, depending on whether the site has a mobile-friendly viewport. |
| 18 // Note that these constants are effective only when the timeout is supported. | 20 // Note that these constants are effective only when the timeout is supported. |
| 19 const int kDesktopTouchAckTimeoutDelayMs = 200; | 21 const int kDesktopTouchAckTimeoutDelayMs = 200; |
| 20 const int kMobileTouchAckTimeoutDelayMs = 1000; | 22 const int kMobileTouchAckTimeoutDelayMs = 1000; |
| 21 | 23 |
| 22 TouchEventQueue::Config GetTouchEventQueueConfig() { | 24 TouchEventQueue::Config GetTouchEventQueueConfig() { |
| 23 TouchEventQueue::Config config; | 25 TouchEventQueue::Config config; |
| 24 | 26 |
| 25 config.desktop_touch_ack_timeout_delay = | 27 config.desktop_touch_ack_timeout_delay = |
| 26 base::TimeDelta::FromMilliseconds(kDesktopTouchAckTimeoutDelayMs); | 28 base::TimeDelta::FromMilliseconds(kDesktopTouchAckTimeoutDelayMs); |
| 27 config.mobile_touch_ack_timeout_delay = | 29 config.mobile_touch_ack_timeout_delay = |
| 28 base::TimeDelta::FromMilliseconds(kMobileTouchAckTimeoutDelayMs); | 30 base::TimeDelta::FromMilliseconds(kMobileTouchAckTimeoutDelayMs); |
| 29 | 31 |
| 30 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
| 31 // For historical reasons only Android enables the touch ack timeout. | 33 // For historical reasons only Android enables the touch ack timeout. The |
| 32 config.touch_ack_timeout_supported = true; | 34 // touch ack timeout will be replaced by an intervention which forces events |
| 35 // to be non-blocking if the main thread is busy. This is currently behind a |
| 36 // flag. |
| 37 config.touch_ack_timeout_supported = !base::FeatureList::IsEnabled( |
| 38 features::kMainThreadBusyScrollIntervention); |
| 33 #else | 39 #else |
| 34 config.touch_ack_timeout_supported = false; | 40 config.touch_ack_timeout_supported = false; |
| 35 #endif | 41 #endif |
| 36 | 42 |
| 37 return config; | 43 return config; |
| 38 } | 44 } |
| 39 | 45 |
| 40 GestureEventQueue::Config GetGestureEventQueueConfig() { | 46 GestureEventQueue::Config GetGestureEventQueueConfig() { |
| 41 GestureEventQueue::Config config; | 47 GestureEventQueue::Config config; |
| 42 ui::GestureConfiguration* gesture_config = | 48 ui::GestureConfiguration* gesture_config = |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } // namespace | 81 } // namespace |
| 76 | 82 |
| 77 InputRouterImpl::Config GetInputRouterConfigForPlatform() { | 83 InputRouterImpl::Config GetInputRouterConfigForPlatform() { |
| 78 InputRouterImpl::Config config; | 84 InputRouterImpl::Config config; |
| 79 config.gesture_config = GetGestureEventQueueConfig(); | 85 config.gesture_config = GetGestureEventQueueConfig(); |
| 80 config.touch_config = GetTouchEventQueueConfig(); | 86 config.touch_config = GetTouchEventQueueConfig(); |
| 81 return config; | 87 return config; |
| 82 } | 88 } |
| 83 | 89 |
| 84 } // namespace content | 90 } // namespace content |
| OLD | NEW |