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 "ui/events/gesture_detection/gesture_config_helper.h" | 5 #include "ui/events/gesture_detection/gesture_config_helper.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "ui/events/event_switches.h" | 10 #include "ui/events/event_switches.h" |
11 #include "ui/events/gestures/gesture_configuration.h" | 11 #include "ui/events/gestures/gesture_configuration.h" |
12 #include "ui/gfx/screen.h" | |
13 | 12 |
14 namespace ui { | 13 namespace ui { |
15 namespace { | 14 namespace { |
16 | 15 |
17 GestureDetector::Config DefaultGestureDetectorConfig() { | 16 GestureDetector::Config DefaultGestureDetectorConfig() { |
18 GestureDetector::Config config; | 17 GestureDetector::Config config; |
19 | 18 |
20 config.longpress_timeout = base::TimeDelta::FromMilliseconds( | 19 config.longpress_timeout = base::TimeDelta::FromMilliseconds( |
21 GestureConfiguration::long_press_time_in_ms()); | 20 GestureConfiguration::long_press_time_in_ms()); |
22 config.showpress_timeout = base::TimeDelta::FromMilliseconds( | 21 config.showpress_timeout = base::TimeDelta::FromMilliseconds( |
(...skipping 27 matching lines...) Expand all Loading... |
50 config.min_scaling_touch_major = GestureConfiguration::default_radius() * 2; | 49 config.min_scaling_touch_major = GestureConfiguration::default_radius() * 2; |
51 config.min_scaling_span = GestureConfiguration::min_scaling_span_in_pixels(); | 50 config.min_scaling_span = GestureConfiguration::min_scaling_span_in_pixels(); |
52 config.min_pinch_update_span_delta = 0; | 51 config.min_pinch_update_span_delta = 0; |
53 return config; | 52 return config; |
54 } | 53 } |
55 | 54 |
56 } // namespace | 55 } // namespace |
57 | 56 |
58 GestureProvider::Config DefaultGestureProviderConfig() { | 57 GestureProvider::Config DefaultGestureProviderConfig() { |
59 GestureProvider::Config config; | 58 GestureProvider::Config config; |
60 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); | |
61 // |screen| is sometimes NULL during tests. | |
62 if (screen) | |
63 config.display = screen->GetPrimaryDisplay(); | |
64 config.gesture_detector_config = DefaultGestureDetectorConfig(); | 59 config.gesture_detector_config = DefaultGestureDetectorConfig(); |
65 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); | 60 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); |
66 config.gesture_begin_end_types_enabled = true; | 61 config.gesture_begin_end_types_enabled = true; |
67 // Half the size of the default touch length is a reasonable minimum. | 62 // Half the size of the default touch length is a reasonable minimum. |
68 config.min_gesture_bounds_length = GestureConfiguration::default_radius(); | 63 config.min_gesture_bounds_length = GestureConfiguration::default_radius(); |
69 return config; | 64 return config; |
70 } | 65 } |
71 | 66 |
72 } // namespace ui | 67 } // namespace ui |
OLD | NEW |