| 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 |
| 11 #if defined(USE_AURA) | 11 #if defined(USE_AURA) |
| 12 #include "ui/events/gestures/gesture_configuration.h" | 12 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 13 #elif defined(OS_ANDROID) | 13 #elif defined(OS_ANDROID) |
| 14 #include "ui/gfx/android/view_configuration.h" | 14 #include "ui/gfx/android/view_configuration.h" |
| 15 #include "ui/gfx/screen.h" | 15 #include "ui/gfx/screen.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 #if defined(USE_AURA) | 21 #if defined(USE_AURA) |
| 22 | 22 |
| 23 GestureEventQueue::Config GetGestureEventQueueConfig() { | 23 GestureEventQueue::Config GetGestureEventQueueConfig() { |
| 24 GestureEventQueue::Config config; | 24 GestureEventQueue::Config config; |
| 25 | 25 |
| 26 config.debounce_interval = base::TimeDelta::FromMilliseconds( | 26 config.debounce_interval = |
| 27 ui::GestureConfiguration::scroll_debounce_interval_in_ms()); | 27 base::TimeDelta::FromMilliseconds(ui::GestureConfiguration::GetInstance() |
| 28 ->scroll_debounce_interval_in_ms()); |
| 28 | 29 |
| 29 config.touchscreen_tap_suppression_config.enabled = true; | 30 config.touchscreen_tap_suppression_config.enabled = true; |
| 30 config.touchscreen_tap_suppression_config.max_cancel_to_down_time = | 31 config.touchscreen_tap_suppression_config.max_cancel_to_down_time = |
| 31 base::TimeDelta::FromMilliseconds( | 32 base::TimeDelta::FromMilliseconds( |
| 32 ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms()); | 33 ui::GestureConfiguration::GetInstance() |
| 34 ->fling_max_cancel_to_down_time_in_ms()); |
| 33 | 35 |
| 34 config.touchscreen_tap_suppression_config.max_tap_gap_time = | 36 config.touchscreen_tap_suppression_config.max_tap_gap_time = |
| 35 base::TimeDelta::FromMilliseconds(static_cast<int>( | 37 base::TimeDelta::FromMilliseconds( |
| 36 ui::GestureConfiguration::semi_long_press_time_in_seconds() * 1000)); | 38 static_cast<int>(ui::GestureConfiguration::GetInstance() |
| 39 ->semi_long_press_time_in_seconds() * |
| 40 1000)); |
| 37 | 41 |
| 38 config.touchpad_tap_suppression_config.enabled = true; | 42 config.touchpad_tap_suppression_config.enabled = true; |
| 39 config.touchpad_tap_suppression_config.max_cancel_to_down_time = | 43 config.touchpad_tap_suppression_config.max_cancel_to_down_time = |
| 40 base::TimeDelta::FromMilliseconds( | 44 base::TimeDelta::FromMilliseconds( |
| 41 ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms()); | 45 ui::GestureConfiguration::GetInstance() |
| 46 ->fling_max_cancel_to_down_time_in_ms()); |
| 42 | 47 |
| 43 config.touchpad_tap_suppression_config.max_tap_gap_time = | 48 config.touchpad_tap_suppression_config |
| 44 base::TimeDelta::FromMilliseconds(static_cast<int>( | 49 .max_tap_gap_time = base::TimeDelta::FromMilliseconds(static_cast<int>( |
| 45 ui::GestureConfiguration::fling_max_tap_gap_time_in_ms() * 1000)); | 50 ui::GestureConfiguration::GetInstance()->fling_max_tap_gap_time_in_ms() * |
| 51 1000)); |
| 46 | 52 |
| 47 return config; | 53 return config; |
| 48 } | 54 } |
| 49 | 55 |
| 50 TouchEventQueue::Config GetTouchEventQueueConfig() { | 56 TouchEventQueue::Config GetTouchEventQueueConfig() { |
| 51 TouchEventQueue::Config config; | 57 TouchEventQueue::Config config; |
| 52 | 58 |
| 53 config.touchmove_slop_suppression_length_dips = | 59 config.touchmove_slop_suppression_length_dips = |
| 54 ui::GestureConfiguration::max_touch_move_in_pixels_for_click(); | 60 ui::GestureConfiguration::GetInstance() |
| 61 ->max_touch_move_in_pixels_for_click(); |
| 55 | 62 |
| 56 return config; | 63 return config; |
| 57 } | 64 } |
| 58 | 65 |
| 59 #elif defined(OS_ANDROID) | 66 #elif defined(OS_ANDROID) |
| 60 | 67 |
| 61 // Default time allowance for the touch ack delay before the touch sequence is | 68 // Default time allowance for the touch ack delay before the touch sequence is |
| 62 // cancelled. | 69 // cancelled. |
| 63 const int kTouchAckTimeoutDelayMs = 200; | 70 const int kTouchAckTimeoutDelayMs = 200; |
| 64 | 71 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 134 |
| 128 InputRouterImpl::Config GetInputRouterConfigForPlatform() { | 135 InputRouterImpl::Config GetInputRouterConfigForPlatform() { |
| 129 InputRouterImpl::Config config; | 136 InputRouterImpl::Config config; |
| 130 config.gesture_config = GetGestureEventQueueConfig(); | 137 config.gesture_config = GetGestureEventQueueConfig(); |
| 131 config.touch_config = GetTouchEventQueueConfig(); | 138 config.touch_config = GetTouchEventQueueConfig(); |
| 132 config.touch_config.touch_scrolling_mode = GetTouchScrollingMode(); | 139 config.touch_config.touch_scrolling_mode = GetTouchScrollingMode(); |
| 133 return config; | 140 return config; |
| 134 } | 141 } |
| 135 | 142 |
| 136 } // namespace content | 143 } // namespace content |
| OLD | NEW |