Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: ui/aura/gestures/gesture_configuration.h

Issue 9751011: Gesture recognition constants should all be stored in the GestureConfiguration object. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Protect unit tests from changes in GestureConfiguration. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef UI_AURA_GESTURES_GESTURE_CONFIGURATION_H_ 5 #ifndef UI_AURA_GESTURES_GESTURE_CONFIGURATION_H_
6 #define UI_AURA_GESTURES_GESTURE_CONFIGURATION_H_ 6 #define UI_AURA_GESTURES_GESTURE_CONFIGURATION_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "ui/aura/aura_export.h" 10 #include "ui/aura/aura_export.h"
11 11
12 namespace aura { 12 namespace aura {
13 13
14 // TODO: Expand this design to support multiple OS configuration 14 // TODO: Expand this design to support multiple OS configuration
15 // approaches (windows, chrome, others). This would turn into an 15 // approaches (windows, chrome, others). This would turn into an
16 // abstract base class. 16 // abstract base class.
17 17
18 class AURA_EXPORT GestureConfiguration { 18 class AURA_EXPORT GestureConfiguration {
19 public: 19 public:
20 static double max_touch_down_duration_in_seconds_for_click() { 20 // Ordered alphabetically ignoring underscores, to align with the
21 return max_touch_down_duration_in_seconds_for_click_; 21 // associated list of prefs in gesture_prefs_aura.cc.
22 static int long_press_time_in_ms() {
23 return long_press_time_in_ms_;
22 } 24 }
23 static void set_max_touch_down_duration_in_seconds_for_click(double val) { 25 static void set_long_press_time_in_ms(int val) {
24 max_touch_down_duration_in_seconds_for_click_ = val; 26 long_press_time_in_ms_ = val;
25 }
26 static double min_touch_down_duration_in_seconds_for_click() {
27 return min_touch_down_duration_in_seconds_for_click_;
28 }
29 static void set_min_touch_down_duration_in_seconds_for_click(double val) {
30 min_touch_down_duration_in_seconds_for_click_ = val;
31 } 27 }
32 static double max_seconds_between_double_click() { 28 static double max_seconds_between_double_click() {
33 return max_seconds_between_double_click_; 29 return max_seconds_between_double_click_;
34 } 30 }
35 static void set_max_seconds_between_double_click(double val) { 31 static void set_max_seconds_between_double_click(double val) {
36 max_seconds_between_double_click_ = val; 32 max_seconds_between_double_click_ = val;
37 } 33 }
34 static double max_touch_down_duration_in_seconds_for_click() {
35 return max_touch_down_duration_in_seconds_for_click_;
36 }
37 static void set_max_touch_down_duration_in_seconds_for_click(double val) {
38 max_touch_down_duration_in_seconds_for_click_ = val;
39 }
38 static double max_touch_move_in_pixels_for_click() { 40 static double max_touch_move_in_pixels_for_click() {
39 return max_touch_move_in_pixels_for_click_; 41 return max_touch_move_in_pixels_for_click_;
40 } 42 }
41 static void set_max_touch_move_in_pixels_for_click(double val) { 43 static void set_max_touch_move_in_pixels_for_click(double val) {
42 max_touch_move_in_pixels_for_click_ = val; 44 max_touch_move_in_pixels_for_click_ = val;
43 } 45 }
46 static double min_distance_for_pinch_scroll_in_pixels() {
47 return min_distance_for_pinch_scroll_in_pixels_;
48 }
49 static void set_min_distance_for_pinch_scroll_in_pixels(double val) {
50 min_distance_for_pinch_scroll_in_pixels_ = val;
51 }
44 static double min_flick_speed_squared() { 52 static double min_flick_speed_squared() {
45 return min_flick_speed_squared_; 53 return min_flick_speed_squared_;
46 } 54 }
47 static void set_min_flick_speed_squared(double val) { 55 static void set_min_flick_speed_squared(double val) {
48 min_flick_speed_squared_ = val; 56 min_flick_speed_squared_ = val;
49 } 57 }
50 static double minimum_pinch_update_distance_in_pixels() { 58 static double min_pinch_update_distance_in_pixels() {
51 return minimum_pinch_update_distance_in_pixels_; 59 return min_pinch_update_distance_in_pixels_;
52 } 60 }
53 static void set_minimum_pinch_update_distance_in_pixels(double val) { 61 static void set_min_pinch_update_distance_in_pixels(double val) {
54 minimum_pinch_update_distance_in_pixels_ = val; 62 min_pinch_update_distance_in_pixels_ = val;
55 } 63 }
56 static double minimum_distance_for_pinch_scroll_in_pixels() { 64 static double min_rail_break_velocity() {
57 return minimum_distance_for_pinch_scroll_in_pixels_; 65 return min_rail_break_velocity_;
58 } 66 }
59 static void set_minimum_distance_for_pinch_scroll_in_pixels(double val) { 67 static void set_min_rail_break_velocity(double val) {
60 minimum_distance_for_pinch_scroll_in_pixels_ = val; 68 min_rail_break_velocity_ = val;
61 } 69 }
70 static double min_scroll_delta_squared() {
71 return min_scroll_delta_squared_;
72 }
73 static void set_min_scroll_delta_squared(double val) {
74 min_scroll_delta_squared_ = val;
75 }
76 static double min_touch_down_duration_in_seconds_for_click() {
77 return min_touch_down_duration_in_seconds_for_click_;
78 }
79 static void set_min_touch_down_duration_in_seconds_for_click(double val) {
80 min_touch_down_duration_in_seconds_for_click_ = val;
81 }
82 static int points_buffered_for_velocity() {
83 return points_buffered_for_velocity_;
84 }
85 static void set_points_buffered_for_velocity(int val) {
86 points_buffered_for_velocity_ = val;
87 }
88 static double rail_break_proportion() {
89 return rail_break_proportion_;
90 }
91 static void set_rail_break_proportion(double val) {
92 rail_break_proportion_ = val;
93 }
94 static double rail_start_proportion() {
95 return rail_start_proportion_;
96 }
97 static void set_rail_start_proportion(double val) {
98 rail_start_proportion_ = val;
99 }
100
62 private: 101 private:
102 // These are listed in alphabetical order ignoring underscores, to
103 // align with the associated list of preferences in
104 // gesture_prefs_aura.cc. These two lists should be kept in sync.
105 static int long_press_time_in_ms_;
106 static double max_seconds_between_double_click_;
63 static double max_touch_down_duration_in_seconds_for_click_; 107 static double max_touch_down_duration_in_seconds_for_click_;
108 static double max_touch_move_in_pixels_for_click_;
109 static double min_distance_for_pinch_scroll_in_pixels_;
110 static double min_flick_speed_squared_;
111 static double min_pinch_update_distance_in_pixels_;
112 static double min_rail_break_velocity_;
113 static double min_scroll_delta_squared_;
64 static double min_touch_down_duration_in_seconds_for_click_; 114 static double min_touch_down_duration_in_seconds_for_click_;
65 static double max_seconds_between_double_click_; 115 static int points_buffered_for_velocity_;
66 static double max_touch_move_in_pixels_for_click_; 116 static double rail_break_proportion_;
67 static double min_flick_speed_squared_; 117 static double rail_start_proportion_;
68 static double minimum_pinch_update_distance_in_pixels_; 118
69 static double minimum_distance_for_pinch_scroll_in_pixels_;
70 119
71 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration); 120 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration);
72 }; 121 };
73 122
74 } // namespace aura 123 } // namespace aura
75 124
76 #endif // UI_AURA_GESTURES_GESTURE_CONFIGURATION_H_ 125 #endif // UI_AURA_GESTURES_GESTURE_CONFIGURATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698