Index: ui/events/gesture_detection/gesture_configuration.h |
diff --git a/ui/events/gesture_detection/gesture_configuration.h b/ui/events/gesture_detection/gesture_configuration.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..036ff2bfbdb83f234906d46a9793b7b934aa8fb1 |
--- /dev/null |
+++ b/ui/events/gesture_detection/gesture_configuration.h |
@@ -0,0 +1,166 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_ |
+#define UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/singleton.h" |
+#include "ui/events/gesture_detection/gesture_detection_export.h" |
+#include "ui/events/gesture_detection/gesture_detector.h" |
+#include "ui/events/gesture_detection/gesture_provider.h" |
+#include "ui/events/gesture_detection/scale_gesture_detector.h" |
+ |
+namespace ui { |
+ |
+class EVENTS_BASE_EXPORT GestureConfiguration { |
+ public: |
+ GestureConfiguration(); |
+ virtual ~GestureConfiguration(); |
+ |
+ static GestureConfiguration* GetInstance(); |
+ |
+ virtual GestureDetector::Config DefaultGestureDetectorConfig(); |
+ virtual ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig(); |
+ |
+ // Ordered alphabetically ignoring underscores, to align with the |
+ // associated list of prefs in gesture_prefs_aura.cc. |
+ virtual int default_radius(); |
+ virtual int fling_max_cancel_to_down_time_in_ms(); |
+ virtual int fling_max_tap_gap_time_in_ms(); |
+ virtual int long_press_timeout_in_ms(); |
+ virtual double semi_long_press_time_in_seconds(); |
+ virtual double max_distance_for_two_finger_tap_in_pixels(); |
+ virtual double max_seconds_between_double_click(); |
+ virtual int max_separation_for_gesture_touches_in_pixels(); |
+ virtual float max_swipe_deviation_angle(); |
+ virtual double max_touch_down_duration_in_seconds_for_click(); |
+ virtual double max_touch_move_in_pixels_for_click(); |
+ virtual double max_distance_between_taps_for_double_tap(); |
+ virtual double min_distance_for_pinch_scroll_in_pixels(); |
+ virtual double min_pinch_update_distance_in_pixels(); |
+ virtual float min_scroll_velocity(); |
jdduke (slow)
2014/10/06 15:50:50
Mixing virtual and inline is a little confusing, p
|
+ virtual double min_swipe_speed(); |
+ virtual int min_scaling_span_in_pixels(); |
+ virtual int show_press_delay_in_ms(); |
+ virtual int scroll_debounce_interval_in_ms(); |
+ virtual float fling_velocity_cap(); |
+ // TODO(davemoore): Move into chrome/browser/ui. |
+ virtual int tab_scrub_activation_delay_in_ms(); |
+ virtual int double_tap_timeout_in_ms(); |
+ virtual int min_scaling_touch_major_in_pixels(); |
+ virtual int touch_slop_in_pixels(); |
+ virtual int span_slop_in_pixels(); |
+ |
+ void set_default_radius(int radius) { default_radius_ = radius; } |
+ void set_fling_max_cancel_to_down_time_in_ms(int val) { |
+ fling_max_cancel_to_down_time_in_ms_ = val; |
+ } |
+ void set_fling_max_tap_gap_time_in_ms(int val) { |
+ fling_max_tap_gap_time_in_ms_ = val; |
+ } |
+ void set_max_distance_for_two_finger_tap_in_pixels(double val) { |
+ max_distance_for_two_finger_tap_in_pixels_ = val; |
+ } |
+ void set_long_press_timeout_in_ms(int val) { |
+ long_press_timeout_in_ms_ = val; |
+ } |
+ void set_semi_long_press_time_in_seconds(double val) { |
+ semi_long_press_time_in_seconds_ = val; |
+ } |
+ void set_max_seconds_between_double_click(double val) { |
+ max_seconds_between_double_click_ = val; |
+ } |
+ void set_max_separation_for_gesture_touches_in_pixels(int val) { |
+ max_separation_for_gesture_touches_in_pixels_ = val; |
+ } |
+ void set_max_swipe_deviation_angle(float val) { |
+ max_swipe_deviation_angle_ = val; |
+ } |
+ void set_max_touch_down_duration_in_seconds_for_click(double val) { |
+ max_touch_down_duration_in_seconds_for_click_ = val; |
+ } |
+ void set_max_touch_move_in_pixels_for_click(double val) { |
+ max_touch_move_in_pixels_for_click_ = val; |
+ } |
+ void set_max_distance_between_taps_for_double_tap(double val) { |
+ max_distance_between_taps_for_double_tap_ = val; |
+ } |
+ void set_min_distance_for_pinch_scroll_in_pixels(double val) { |
+ min_distance_for_pinch_scroll_in_pixels_ = val; |
+ } |
+ void set_min_pinch_update_distance_in_pixels(double val) { |
+ min_pinch_update_distance_in_pixels_ = val; |
+ } |
+ void set_min_scroll_velocity(float val) { min_scroll_velocity_ = val; } |
+ void set_min_swipe_speed(double val) { min_swipe_speed_ = val; } |
+ void set_min_scaling_span_in_pixels(int val) { |
+ min_scaling_span_in_pixels_ = val; |
+ } |
+ int set_show_press_delay_in_ms(int val) { |
+ return show_press_delay_in_ms_ = val; |
+ } |
+ int set_scroll_debounce_interval_in_ms(int val) { |
+ return scroll_debounce_interval_in_ms_ = val; |
+ } |
+ void set_fling_velocity_cap(float val) { fling_velocity_cap_ = val; } |
+ void set_tab_scrub_activation_delay_in_ms(int val) { |
+ tab_scrub_activation_delay_in_ms_ = val; |
+ } |
+ |
+ private: |
+ // These are listed in alphabetical order ignoring underscores, to |
+ // align with the associated list of preferences in |
+ // gesture_prefs_aura.cc. These two lists should be kept in sync. |
+ |
+ // The default touch radius length used when the only information given |
+ // by the device is the touch center. |
+ int default_radius_; |
+ |
+ // The maximum allowed distance between two fingers for a two finger tap. If |
+ // the distance between two fingers is greater than this value, we will not |
+ // recognize a two finger tap. |
+ double max_distance_for_two_finger_tap_in_pixels_; |
+ |
+ // Maximum time between a GestureFlingCancel and a mousedown such that the |
+ // mousedown is considered associated with the cancel event. |
+ int fling_max_cancel_to_down_time_in_ms_; |
+ |
+ // Maxium time between a mousedown/mouseup pair that is considered to be a |
+ // suppressable tap. |
+ int fling_max_tap_gap_time_in_ms_; |
+ float fling_velocity_cap_; |
+ int tab_scrub_activation_delay_in_ms_; |
+ int long_press_timeout_in_ms_; |
+ double semi_long_press_time_in_seconds_; |
+ double max_seconds_between_double_click_; |
+ double max_separation_for_gesture_touches_in_pixels_; |
+ float max_swipe_deviation_angle_; |
+ double max_touch_down_duration_in_seconds_for_click_; |
+ double max_touch_move_in_pixels_for_click_; |
+ double max_distance_between_taps_for_double_tap_; |
+ double min_distance_for_pinch_scroll_in_pixels_; |
+ // Only used with --compensate-for-unstable-pinch-zoom. |
+ double min_pinch_update_distance_in_pixels_; |
+ float min_scroll_velocity_; |
+ double min_swipe_speed_; |
+ int min_scaling_span_in_pixels_; |
+ int show_press_delay_in_ms_; |
+ int scroll_debounce_interval_in_ms_; |
+ // TODO(davemoore): Move into chrome/browser/ui. |
+ int double_tap_timeout_in_ms_; |
+ // These values may vary as view-specific parameters (DPI scale) are changed, |
+ // so read/write access must be synchronized. |
+ int span_slop_in_pixels_; |
+ int min_scaling_touch_major_in_pixels_; |
+ int touch_slop_in_pixels_; |
+ friend struct DefaultSingletonTraits<GestureConfiguration>; |
+ DISALLOW_COPY_AND_ASSIGN(GestureConfiguration); |
+}; |
+ |
+GESTURE_DETECTION_EXPORT GestureProvider::Config DefaultGestureProviderConfig(); |
+ |
+} // namespace ui |
+ |
+#endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_ |