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..81effb2f468f699b9f4f737f5949232f653e9e30 |
--- /dev/null |
+++ b/ui/events/gesture_detection/gesture_configuration.h |
@@ -0,0 +1,228 @@ |
+// 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/command_line.h" |
+#include "base/memory/singleton.h" |
+#include "ui/events/event_switches.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" |
+#include "ui/gfx/screen.h" |
+ |
+namespace ui { |
+ |
+class GESTURE_DETECTION_EXPORT GestureConfiguration { |
+ public: |
+ GestureConfiguration(); |
jdduke (slow)
2014/10/22 17:31:34
I believe this constructor should be protected?
lanwei
2014/10/23 01:26:18
Done.
|
+ virtual ~GestureConfiguration(); |
+ |
+ static GestureConfiguration* GetInstance(); |
+ |
+ GestureProvider::Config DefaultGestureProviderConfig(); |
+ GestureDetector::Config DefaultGestureDetectorConfig(); |
+ ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig(); |
+ |
+ // Ordered alphabetically ignoring underscores. |
+ float default_radius() { return default_radius_; } |
+ void set_default_radius(float radius) { |
+ default_radius_ = radius; |
+ min_scaling_touch_major_ = default_radius_ * 2; |
+ min_gesture_bounds_length_ = default_radius_; |
+ } |
+ int fling_max_cancel_to_down_time_in_ms() { |
+ return fling_max_cancel_to_down_time_in_ms_; |
+ } |
+ void set_fling_max_cancel_to_down_time_in_ms(int val) { |
+ fling_max_cancel_to_down_time_in_ms_ = val; |
+ } |
+ int fling_max_tap_gap_time_in_ms() { return fling_max_tap_gap_time_in_ms_; } |
+ void set_fling_max_tap_gap_time_in_ms(int val) { |
+ fling_max_tap_gap_time_in_ms_ = val; |
+ } |
+ float fling_velocity_cap() { return fling_velocity_cap_; } |
+ void set_fling_velocity_cap(float val) { fling_velocity_cap_ = val; } |
+ bool gesture_begin_end_types_enabled() { |
+ return gesture_begin_end_types_enabled_; |
+ } |
+ void set_gesture_begin_end_types_enabled(bool val) { |
+ gesture_begin_end_types_enabled_ = val; |
+ } |
+ int long_press_time_in_ms() { return long_press_time_in_ms_; } |
+ void set_long_press_time_in_ms(int val) { long_press_time_in_ms_ = val; } |
+ float max_distance_between_taps_for_double_tap() { |
+ return max_distance_between_taps_for_double_tap_; |
+ } |
+ void set_max_distance_between_taps_for_double_tap(float val) { |
+ max_distance_between_taps_for_double_tap_ = val; |
+ } |
+ float max_distance_for_two_finger_tap_in_pixels() { |
jdduke (slow)
2014/10/22 17:56:18
One last question. All of these properties have se
lanwei
2014/10/23 01:26:18
Done.
|
+ return max_distance_for_two_finger_tap_in_pixels_; |
+ } |
+ void set_max_distance_for_two_finger_tap_in_pixels(float val) { |
+ max_distance_for_two_finger_tap_in_pixels_ = val; |
+ } |
+ float max_gesture_bounds_length() { return max_gesture_bounds_length_; } |
+ void set_max_gesture_bounds_length(float val) { |
+ max_gesture_bounds_length_ = val; |
+ } |
+ float max_separation_for_gesture_touches_in_pixels() { |
+ return max_separation_for_gesture_touches_in_pixels_; |
+ } |
+ void set_max_separation_for_gesture_touches_in_pixels(float val) { |
+ max_separation_for_gesture_touches_in_pixels_ = val; |
+ } |
+ float max_swipe_deviation_angle() { return max_swipe_deviation_angle_; } |
+ void set_max_swipe_deviation_angle(float val) { |
+ max_swipe_deviation_angle_ = val; |
+ } |
+ int max_time_between_double_click_in_ms() { |
+ return max_time_between_double_click_in_ms_; |
+ } |
+ void set_max_time_between_double_click_in_ms(int val) { |
+ max_time_between_double_click_in_ms_ = val; |
+ } |
+ int max_touch_down_duration_for_click_in_ms() { |
+ return max_touch_down_duration_for_click_in_ms_; |
+ } |
+ void set_max_touch_down_duration_for_click_in_ms(int val) { |
+ max_touch_down_duration_for_click_in_ms_ = val; |
+ } |
+ float max_touch_move_in_pixels_for_click() { |
+ return max_touch_move_in_pixels_for_click_; |
+ } |
+ void set_max_touch_move_in_pixels_for_click(float val) { |
+ max_touch_move_in_pixels_for_click_ = val; |
+ span_slop_ = max_touch_move_in_pixels_for_click_ * 2; |
+ } |
+ float min_distance_for_pinch_scroll_in_pixels() { |
+ return min_distance_for_pinch_scroll_in_pixels_; |
+ } |
+ void set_min_distance_for_pinch_scroll_in_pixels(float val) { |
+ min_distance_for_pinch_scroll_in_pixels_ = val; |
+ } |
+ float min_gesture_bounds_length() { return min_gesture_bounds_length_; } |
+ void set_min_gesture_bounds_length(float val) { |
+ min_gesture_bounds_length_ = val; |
+ } |
+ float min_pinch_update_distance_in_pixels() { |
+ return min_pinch_update_distance_in_pixels_; |
+ } |
+ void set_min_pinch_update_distance_in_pixels(float val) { |
+ min_pinch_update_distance_in_pixels_ = val; |
+ min_pinch_update_span_delta_ = |
+ CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kCompensateForUnstablePinchZoom) |
+ ? min_pinch_update_distance_in_pixels() |
+ : 0; |
+ } |
+ float min_pinch_update_span_delta() { return min_pinch_update_span_delta_; } |
+ void set_min_pinch_update_span_delta(float val) { |
+ min_pinch_update_span_delta_ = val; |
+ } |
+ float min_scaling_span_in_pixels() { return min_scaling_span_in_pixels_; } |
+ void set_min_scaling_span_in_pixels(float val) { |
+ min_scaling_span_in_pixels_ = val; |
+ } |
+ float min_scaling_touch_major() { return min_scaling_touch_major_; } |
+ void set_min_scaling_touch_major(float val) { |
+ min_scaling_touch_major_ = val; |
+ } |
+ float min_scroll_velocity() { return min_scroll_velocity_; } |
+ void set_min_scroll_velocity(float val) { min_scroll_velocity_ = val; } |
+ float min_swipe_speed() { return min_swipe_speed_; } |
+ void set_min_swipe_speed(float val) { min_swipe_speed_ = val; } |
+ int scroll_debounce_interval_in_ms() { |
+ return scroll_debounce_interval_in_ms_; |
+ } |
+ int set_scroll_debounce_interval_in_ms(int val) { |
+ return scroll_debounce_interval_in_ms_ = val; |
+ } |
+ int semi_long_press_time_in_ms() { return semi_long_press_time_in_ms_; } |
+ void set_semi_long_press_time_in_ms(int val) { |
+ semi_long_press_time_in_ms_ = val; |
+ } |
+ int show_press_delay_in_ms() { return show_press_delay_in_ms_; } |
+ int set_show_press_delay_in_ms(int val) { |
+ return show_press_delay_in_ms_ = val; |
+ } |
+ float span_slop() { return span_slop_; } |
+ void set_span_slop(float val) { span_slop_ = val; } |
+ bool swipe_enabled() { return swipe_enabled_; } |
+ void set_swipe_enabled(bool val) { swipe_enabled_ = val; } |
+ |
+ // TODO(davemoore): Move into chrome/browser/ui. |
+ int tab_scrub_activation_delay_in_ms() { |
+ return tab_scrub_activation_delay_in_ms_; |
+ } |
+ void set_tab_scrub_activation_delay_in_ms(int val) { |
+ tab_scrub_activation_delay_in_ms_ = val; |
+ } |
+ bool two_finger_tap_enabled() { return two_finger_tap_enabled_; } |
+ void set_two_finger_tap_enabled(bool val) { two_finger_tap_enabled_ = val; } |
+ gfx::Display display() { return display_; } |
jdduke (slow)
2014/10/22 17:31:34
Display probably does not belong here.
lanwei
2014/10/23 01:26:18
Done.
|
+ void set_display(gfx::Display val) { display_ = val; } |
+ |
+ private: |
+ // These are listed in alphabetical order ignoring underscores. |
+ |
+ // The default touch radius length used when the only information given |
+ // by the device is the touch center. |
+ float default_radius_; |
+ |
+ // 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_; |
+ bool gesture_begin_end_types_enabled_; |
+ int long_press_time_in_ms_; |
+ float max_distance_between_taps_for_double_tap_; |
+ |
+ // 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. |
+ float max_distance_for_two_finger_tap_in_pixels_; |
+ float max_gesture_bounds_length_; |
+ float max_separation_for_gesture_touches_in_pixels_; |
+ float max_swipe_deviation_angle_; |
+ int max_time_between_double_click_in_ms_; |
+ int max_touch_down_duration_for_click_in_ms_; |
+ float max_touch_move_in_pixels_for_click_; |
+ float min_distance_for_pinch_scroll_in_pixels_; |
+ float min_gesture_bounds_length_; |
+ // Only used with --compensate-for-unstable-pinch-zoom. |
+ float min_pinch_update_distance_in_pixels_; |
+ float min_pinch_update_span_delta_; |
+ float min_scaling_span_in_pixels_; |
+ float min_scaling_touch_major_; |
+ float min_scroll_velocity_; |
+ float min_swipe_speed_; |
+ int scroll_debounce_interval_in_ms_; |
+ int semi_long_press_time_in_ms_; |
+ int show_press_delay_in_ms_; |
+ float span_slop_; |
+ bool swipe_enabled_; |
+ |
+ // TODO(davemoore): Move into chrome/browser/ui. |
+ int tab_scrub_activation_delay_in_ms_; |
+ bool two_finger_tap_enabled_; |
+ gfx::Display display_; |
+ |
+ 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_ |