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

Side by Side Diff: chrome/browser/ui/gesture_prefs_observer_factory_aura.cc

Issue 10037012: Three Finger Swipe (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove pinch/scroll start/end calls Created 8 years, 8 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
« no previous file with comments | « ash/wm/system_gesture_event_filter_unittest.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/ui/gesture_prefs_observer_factory_aura.h" 5 #include "chrome/browser/ui/gesture_prefs_observer_factory_aura.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "chrome/browser/prefs/pref_change_registrar.h" 8 #include "chrome/browser/prefs/pref_change_registrar.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 DISALLOW_COPY_AND_ASSIGN(GesturePrefsObserver); 42 DISALLOW_COPY_AND_ASSIGN(GesturePrefsObserver);
43 }; 43 };
44 44
45 // The list of prefs we want to observe. 45 // The list of prefs we want to observe.
46 // Note that this collection of settings should correspond to the settings used 46 // Note that this collection of settings should correspond to the settings used
47 // in ui/base/gestures/gesture_configuration.h 47 // in ui/base/gestures/gesture_configuration.h
48 const char* kPrefsToObserve[] = { 48 const char* kPrefsToObserve[] = {
49 prefs::kLongPressTimeInSeconds, 49 prefs::kLongPressTimeInSeconds,
50 prefs::kMaxSecondsBetweenDoubleClick, 50 prefs::kMaxSecondsBetweenDoubleClick,
51 prefs::kMaxSeparationForGestureTouchesInPixels, 51 prefs::kMaxSeparationForGestureTouchesInPixels,
52 prefs::kMaxSwipeDeviationRatio,
52 prefs::kMaxTouchDownDurationInSecondsForClick, 53 prefs::kMaxTouchDownDurationInSecondsForClick,
53 prefs::kMaxTouchMoveInPixelsForClick, 54 prefs::kMaxTouchMoveInPixelsForClick,
54 prefs::kMinDistanceForPinchScrollInPixels, 55 prefs::kMinDistanceForPinchScrollInPixels,
55 prefs::kMinFlickSpeedSquared, 56 prefs::kMinFlickSpeedSquared,
56 prefs::kMinPinchUpdateDistanceInPixels, 57 prefs::kMinPinchUpdateDistanceInPixels,
57 prefs::kMinRailBreakVelocity, 58 prefs::kMinRailBreakVelocity,
58 prefs::kMinScrollDeltaSquared, 59 prefs::kMinScrollDeltaSquared,
60 prefs::kMinSwipeSpeed,
59 prefs::kMinTouchDownDurationInSecondsForClick, 61 prefs::kMinTouchDownDurationInSecondsForClick,
60 prefs::kPointsBufferedForVelocity, 62 prefs::kPointsBufferedForVelocity,
61 prefs::kRailBreakProportion, 63 prefs::kRailBreakProportion,
62 prefs::kRailStartProportion, 64 prefs::kRailStartProportion,
63 }; 65 };
64 66
65 GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs) 67 GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs)
66 : prefs_(prefs) { 68 : prefs_(prefs) {
67 registrar_.Init(prefs); 69 registrar_.Init(prefs);
68 registrar_.RemoveAll(); 70 registrar_.RemoveAll();
(...skipping 17 matching lines...) Expand all
86 void GesturePrefsObserver::Update() { 88 void GesturePrefsObserver::Update() {
87 GestureConfiguration::set_long_press_time_in_seconds( 89 GestureConfiguration::set_long_press_time_in_seconds(
88 prefs_->GetDouble( 90 prefs_->GetDouble(
89 prefs::kLongPressTimeInSeconds)); 91 prefs::kLongPressTimeInSeconds));
90 GestureConfiguration::set_max_seconds_between_double_click( 92 GestureConfiguration::set_max_seconds_between_double_click(
91 prefs_->GetDouble( 93 prefs_->GetDouble(
92 prefs::kMaxSecondsBetweenDoubleClick)); 94 prefs::kMaxSecondsBetweenDoubleClick));
93 GestureConfiguration::set_max_separation_for_gesture_touches_in_pixels( 95 GestureConfiguration::set_max_separation_for_gesture_touches_in_pixels(
94 prefs_->GetDouble( 96 prefs_->GetDouble(
95 prefs::kMaxSeparationForGestureTouchesInPixels)); 97 prefs::kMaxSeparationForGestureTouchesInPixels));
98 GestureConfiguration::set_max_swipe_deviation_ratio(
99 prefs_->GetDouble(
100 prefs::kMaxSwipeDeviationRatio));
96 GestureConfiguration::set_max_touch_down_duration_in_seconds_for_click( 101 GestureConfiguration::set_max_touch_down_duration_in_seconds_for_click(
97 prefs_->GetDouble( 102 prefs_->GetDouble(
98 prefs::kMaxTouchDownDurationInSecondsForClick)); 103 prefs::kMaxTouchDownDurationInSecondsForClick));
99 GestureConfiguration::set_max_touch_move_in_pixels_for_click( 104 GestureConfiguration::set_max_touch_move_in_pixels_for_click(
100 prefs_->GetDouble( 105 prefs_->GetDouble(
101 prefs::kMaxTouchMoveInPixelsForClick)); 106 prefs::kMaxTouchMoveInPixelsForClick));
102 GestureConfiguration::set_min_distance_for_pinch_scroll_in_pixels( 107 GestureConfiguration::set_min_distance_for_pinch_scroll_in_pixels(
103 prefs_->GetDouble( 108 prefs_->GetDouble(
104 prefs::kMinDistanceForPinchScrollInPixels)); 109 prefs::kMinDistanceForPinchScrollInPixels));
105 GestureConfiguration::set_min_flick_speed_squared( 110 GestureConfiguration::set_min_flick_speed_squared(
106 prefs_->GetDouble( 111 prefs_->GetDouble(
107 prefs::kMinFlickSpeedSquared)); 112 prefs::kMinFlickSpeedSquared));
108 GestureConfiguration::set_min_pinch_update_distance_in_pixels( 113 GestureConfiguration::set_min_pinch_update_distance_in_pixels(
109 prefs_->GetDouble( 114 prefs_->GetDouble(
110 prefs::kMinPinchUpdateDistanceInPixels)); 115 prefs::kMinPinchUpdateDistanceInPixels));
111 GestureConfiguration::set_min_rail_break_velocity( 116 GestureConfiguration::set_min_rail_break_velocity(
112 prefs_->GetDouble( 117 prefs_->GetDouble(
113 prefs::kMinRailBreakVelocity)); 118 prefs::kMinRailBreakVelocity));
114 GestureConfiguration::set_min_scroll_delta_squared( 119 GestureConfiguration::set_min_scroll_delta_squared(
115 prefs_->GetDouble( 120 prefs_->GetDouble(
116 prefs::kMinScrollDeltaSquared)); 121 prefs::kMinScrollDeltaSquared));
122 GestureConfiguration::set_min_swipe_speed(
123 prefs_->GetDouble(
124 prefs::kMinSwipeSpeed));
117 GestureConfiguration::set_min_touch_down_duration_in_seconds_for_click( 125 GestureConfiguration::set_min_touch_down_duration_in_seconds_for_click(
118 prefs_->GetDouble( 126 prefs_->GetDouble(
119 prefs::kMinTouchDownDurationInSecondsForClick)); 127 prefs::kMinTouchDownDurationInSecondsForClick));
120 GestureConfiguration::set_points_buffered_for_velocity( 128 GestureConfiguration::set_points_buffered_for_velocity(
121 prefs_->GetInteger( 129 prefs_->GetInteger(
122 prefs::kPointsBufferedForVelocity)); 130 prefs::kPointsBufferedForVelocity));
123 GestureConfiguration::set_rail_break_proportion( 131 GestureConfiguration::set_rail_break_proportion(
124 prefs_->GetDouble( 132 prefs_->GetDouble(
125 prefs::kRailBreakProportion)); 133 prefs::kRailBreakProportion));
126 GestureConfiguration::set_rail_start_proportion( 134 GestureConfiguration::set_rail_start_proportion(
(...skipping 27 matching lines...) Expand all
154 PrefService::UNSYNCABLE_PREF); 162 PrefService::UNSYNCABLE_PREF);
155 prefs->RegisterDoublePref( 163 prefs->RegisterDoublePref(
156 prefs::kMaxSecondsBetweenDoubleClick, 164 prefs::kMaxSecondsBetweenDoubleClick,
157 GestureConfiguration::max_seconds_between_double_click(), 165 GestureConfiguration::max_seconds_between_double_click(),
158 PrefService::UNSYNCABLE_PREF); 166 PrefService::UNSYNCABLE_PREF);
159 prefs->RegisterDoublePref( 167 prefs->RegisterDoublePref(
160 prefs::kMaxSeparationForGestureTouchesInPixels, 168 prefs::kMaxSeparationForGestureTouchesInPixels,
161 GestureConfiguration::max_separation_for_gesture_touches_in_pixels(), 169 GestureConfiguration::max_separation_for_gesture_touches_in_pixels(),
162 PrefService::UNSYNCABLE_PREF); 170 PrefService::UNSYNCABLE_PREF);
163 prefs->RegisterDoublePref( 171 prefs->RegisterDoublePref(
172 prefs::kMaxSwipeDeviationRatio,
173 GestureConfiguration::max_swipe_deviation_ratio(),
174 PrefService::UNSYNCABLE_PREF);
175 prefs->RegisterDoublePref(
164 prefs::kMaxTouchDownDurationInSecondsForClick, 176 prefs::kMaxTouchDownDurationInSecondsForClick,
165 GestureConfiguration::max_touch_down_duration_in_seconds_for_click(), 177 GestureConfiguration::max_touch_down_duration_in_seconds_for_click(),
166 PrefService::UNSYNCABLE_PREF); 178 PrefService::UNSYNCABLE_PREF);
167 prefs->RegisterDoublePref( 179 prefs->RegisterDoublePref(
168 prefs::kMaxTouchMoveInPixelsForClick, 180 prefs::kMaxTouchMoveInPixelsForClick,
169 GestureConfiguration::max_touch_move_in_pixels_for_click(), 181 GestureConfiguration::max_touch_move_in_pixels_for_click(),
170 PrefService::UNSYNCABLE_PREF); 182 PrefService::UNSYNCABLE_PREF);
171 prefs->RegisterDoublePref( 183 prefs->RegisterDoublePref(
172 prefs::kMinDistanceForPinchScrollInPixels, 184 prefs::kMinDistanceForPinchScrollInPixels,
173 GestureConfiguration::min_distance_for_pinch_scroll_in_pixels(), 185 GestureConfiguration::min_distance_for_pinch_scroll_in_pixels(),
174 PrefService::UNSYNCABLE_PREF); 186 PrefService::UNSYNCABLE_PREF);
175 prefs->RegisterDoublePref( 187 prefs->RegisterDoublePref(
176 prefs::kMinFlickSpeedSquared, 188 prefs::kMinFlickSpeedSquared,
177 GestureConfiguration::min_flick_speed_squared(), 189 GestureConfiguration::min_flick_speed_squared(),
178 PrefService::UNSYNCABLE_PREF); 190 PrefService::UNSYNCABLE_PREF);
179 prefs->RegisterDoublePref( 191 prefs->RegisterDoublePref(
180 prefs::kMinPinchUpdateDistanceInPixels, 192 prefs::kMinPinchUpdateDistanceInPixels,
181 GestureConfiguration::min_pinch_update_distance_in_pixels(), 193 GestureConfiguration::min_pinch_update_distance_in_pixels(),
182 PrefService::UNSYNCABLE_PREF); 194 PrefService::UNSYNCABLE_PREF);
183 prefs->RegisterDoublePref( 195 prefs->RegisterDoublePref(
184 prefs::kMinRailBreakVelocity, 196 prefs::kMinRailBreakVelocity,
185 GestureConfiguration::min_rail_break_velocity(), 197 GestureConfiguration::min_rail_break_velocity(),
186 PrefService::UNSYNCABLE_PREF); 198 PrefService::UNSYNCABLE_PREF);
187 prefs->RegisterDoublePref( 199 prefs->RegisterDoublePref(
188 prefs::kMinScrollDeltaSquared, 200 prefs::kMinScrollDeltaSquared,
189 GestureConfiguration::min_scroll_delta_squared(), 201 GestureConfiguration::min_scroll_delta_squared(),
190 PrefService::UNSYNCABLE_PREF); 202 PrefService::UNSYNCABLE_PREF);
191 prefs->RegisterDoublePref( 203 prefs->RegisterDoublePref(
204 prefs::kMinSwipeSpeed,
205 GestureConfiguration::min_swipe_speed(),
206 PrefService::UNSYNCABLE_PREF);
207 prefs->RegisterDoublePref(
192 prefs::kMinTouchDownDurationInSecondsForClick, 208 prefs::kMinTouchDownDurationInSecondsForClick,
193 GestureConfiguration::min_touch_down_duration_in_seconds_for_click(), 209 GestureConfiguration::min_touch_down_duration_in_seconds_for_click(),
194 PrefService::UNSYNCABLE_PREF); 210 PrefService::UNSYNCABLE_PREF);
195 prefs->RegisterIntegerPref( 211 prefs->RegisterIntegerPref(
196 prefs::kPointsBufferedForVelocity, 212 prefs::kPointsBufferedForVelocity,
197 GestureConfiguration::points_buffered_for_velocity(), 213 GestureConfiguration::points_buffered_for_velocity(),
198 PrefService::UNSYNCABLE_PREF); 214 PrefService::UNSYNCABLE_PREF);
199 prefs->RegisterDoublePref( 215 prefs->RegisterDoublePref(
200 prefs::kRailBreakProportion, 216 prefs::kRailBreakProportion,
201 GestureConfiguration::rail_break_proportion(), 217 GestureConfiguration::rail_break_proportion(),
(...skipping 13 matching lines...) Expand all
215 // Use same gesture preferences on incognito windows. 231 // Use same gesture preferences on incognito windows.
216 return true; 232 return true;
217 } 233 }
218 234
219 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() { 235 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() {
220 // Some tests replace the PrefService of the TestingProfile after the 236 // Some tests replace the PrefService of the TestingProfile after the
221 // GesturePrefsObserver has been created, which makes Shutdown() 237 // GesturePrefsObserver has been created, which makes Shutdown()
222 // remove the registrar from a non-existent PrefService. 238 // remove the registrar from a non-existent PrefService.
223 return true; 239 return true;
224 } 240 }
OLDNEW
« no previous file with comments | « ash/wm/system_gesture_event_filter_unittest.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698