| 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 "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
| 9 #include "ui/events/gesture_detection/gesture_detector.h" | 9 #include "ui/events/gesture_detection/gesture_detector.h" |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 gesture_config->fling_max_cancel_to_down_time_in_ms()); | 43 gesture_config->fling_max_cancel_to_down_time_in_ms()); |
| 44 | 44 |
| 45 config.touchpad_tap_suppression_config.max_tap_gap_time = | 45 config.touchpad_tap_suppression_config.max_tap_gap_time = |
| 46 base::TimeDelta::FromMilliseconds( | 46 base::TimeDelta::FromMilliseconds( |
| 47 gesture_config->fling_max_tap_gap_time_in_ms()); | 47 gesture_config->fling_max_tap_gap_time_in_ms()); |
| 48 | 48 |
| 49 return config; | 49 return config; |
| 50 } | 50 } |
| 51 | 51 |
| 52 TouchEventQueue::Config GetTouchEventQueueConfig() { | 52 TouchEventQueue::Config GetTouchEventQueueConfig() { |
| 53 TouchEventQueue::Config config; | 53 return TouchEventQueue::Config(); |
| 54 | |
| 55 config.touchmove_slop_suppression_length_dips = | |
| 56 ui::GestureConfiguration::GetInstance() | |
| 57 ->max_touch_move_in_pixels_for_click(); | |
| 58 | |
| 59 return config; | |
| 60 } | 54 } |
| 61 | 55 |
| 62 #elif defined(OS_ANDROID) | 56 #elif defined(OS_ANDROID) |
| 63 | 57 |
| 64 // Default time allowance for the touch ack delay before the touch sequence is | 58 // Default time allowance for the touch ack delay before the touch sequence is |
| 65 // cancelled. | 59 // cancelled. |
| 66 const int kTouchAckTimeoutDelayMs = 200; | 60 const int kTouchAckTimeoutDelayMs = 200; |
| 67 | 61 |
| 68 GestureEventQueue::Config GetGestureEventQueueConfig() { | 62 GestureEventQueue::Config GetGestureEventQueueConfig() { |
| 69 GestureEventQueue::Config config; | 63 GestureEventQueue::Config config; |
| 70 | 64 |
| 71 config.touchscreen_tap_suppression_config.enabled = true; | 65 config.touchscreen_tap_suppression_config.enabled = true; |
| 72 config.touchscreen_tap_suppression_config.max_cancel_to_down_time = | 66 config.touchscreen_tap_suppression_config.max_cancel_to_down_time = |
| 73 base::TimeDelta::FromMilliseconds( | 67 base::TimeDelta::FromMilliseconds( |
| 74 gfx::ViewConfiguration::GetTapTimeoutInMs()); | 68 gfx::ViewConfiguration::GetTapTimeoutInMs()); |
| 75 config.touchscreen_tap_suppression_config.max_tap_gap_time = | 69 config.touchscreen_tap_suppression_config.max_tap_gap_time = |
| 76 base::TimeDelta::FromMilliseconds( | 70 base::TimeDelta::FromMilliseconds( |
| 77 gfx::ViewConfiguration::GetLongPressTimeoutInMs()); | 71 gfx::ViewConfiguration::GetLongPressTimeoutInMs()); |
| 78 | 72 |
| 79 return config; | 73 return config; |
| 80 } | 74 } |
| 81 | 75 |
| 82 TouchEventQueue::Config GetTouchEventQueueConfig() { | 76 TouchEventQueue::Config GetTouchEventQueueConfig() { |
| 83 TouchEventQueue::Config config; | 77 TouchEventQueue::Config config; |
| 84 | 78 |
| 85 config.touch_ack_timeout_delay = | 79 config.touch_ack_timeout_delay = |
| 86 base::TimeDelta::FromMilliseconds(kTouchAckTimeoutDelayMs); | 80 base::TimeDelta::FromMilliseconds(kTouchAckTimeoutDelayMs); |
| 87 config.touch_ack_timeout_supported = true; | 81 config.touch_ack_timeout_supported = true; |
| 88 | 82 |
| 89 const double touch_slop_length_pixels = | |
| 90 static_cast<double>(gfx::ViewConfiguration::GetTouchSlopInPixels()); | |
| 91 const double device_scale_factor = | |
| 92 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor(); | |
| 93 config.touchmove_slop_suppression_length_dips = | |
| 94 touch_slop_length_pixels / device_scale_factor; | |
| 95 | |
| 96 return config; | 83 return config; |
| 97 } | 84 } |
| 98 | 85 |
| 99 #else | 86 #else |
| 100 | 87 |
| 101 GestureEventQueue::Config GetGestureEventQueueConfig() { | 88 GestureEventQueue::Config GetGestureEventQueueConfig() { |
| 102 return GestureEventQueue::Config(); | 89 return GestureEventQueue::Config(); |
| 103 } | 90 } |
| 104 | 91 |
| 105 TouchEventQueue::Config GetTouchEventQueueConfig() { | 92 TouchEventQueue::Config GetTouchEventQueueConfig() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 130 | 117 |
| 131 InputRouterImpl::Config GetInputRouterConfigForPlatform() { | 118 InputRouterImpl::Config GetInputRouterConfigForPlatform() { |
| 132 InputRouterImpl::Config config; | 119 InputRouterImpl::Config config; |
| 133 config.gesture_config = GetGestureEventQueueConfig(); | 120 config.gesture_config = GetGestureEventQueueConfig(); |
| 134 config.touch_config = GetTouchEventQueueConfig(); | 121 config.touch_config = GetTouchEventQueueConfig(); |
| 135 config.touch_config.touch_scrolling_mode = GetTouchScrollingMode(); | 122 config.touch_config.touch_scrolling_mode = GetTouchScrollingMode(); |
| 136 return config; | 123 return config; |
| 137 } | 124 } |
| 138 | 125 |
| 139 } // namespace content | 126 } // namespace content |
| OLD | NEW |