OLD | NEW |
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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/prefs/public/pref_change_registrar.h" | 10 #include "base/prefs/public/pref_change_registrar.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 }; | 67 }; |
68 | 68 |
69 // The list of prefs we want to observe. | 69 // The list of prefs we want to observe. |
70 // Note that this collection of settings should correspond to the settings used | 70 // Note that this collection of settings should correspond to the settings used |
71 // in ui/base/gestures/gesture_configuration.h | 71 // in ui/base/gestures/gesture_configuration.h |
72 const char* kPrefsToObserve[] = { | 72 const char* kPrefsToObserve[] = { |
73 prefs::kFlingAccelerationCurveCoefficient0, | 73 prefs::kFlingAccelerationCurveCoefficient0, |
74 prefs::kFlingAccelerationCurveCoefficient1, | 74 prefs::kFlingAccelerationCurveCoefficient1, |
75 prefs::kFlingAccelerationCurveCoefficient2, | 75 prefs::kFlingAccelerationCurveCoefficient2, |
76 prefs::kFlingAccelerationCurveCoefficient3, | 76 prefs::kFlingAccelerationCurveCoefficient3, |
| 77 prefs::kFlingMaxCancelToDownTimeInMs, |
| 78 prefs::kFlingMaxTapGapTimeInMs, |
77 prefs::kFlingVelocityCap, | 79 prefs::kFlingVelocityCap, |
78 prefs::kLongPressTimeInSeconds, | 80 prefs::kLongPressTimeInSeconds, |
79 prefs::kMaxDistanceForTwoFingerTapInPixels, | 81 prefs::kMaxDistanceForTwoFingerTapInPixels, |
80 prefs::kMaxSecondsBetweenDoubleClick, | 82 prefs::kMaxSecondsBetweenDoubleClick, |
81 prefs::kMaxSeparationForGestureTouchesInPixels, | 83 prefs::kMaxSeparationForGestureTouchesInPixels, |
82 prefs::kMaxSwipeDeviationRatio, | 84 prefs::kMaxSwipeDeviationRatio, |
83 prefs::kMaxTouchDownDurationInSecondsForClick, | 85 prefs::kMaxTouchDownDurationInSecondsForClick, |
84 prefs::kMaxTouchMoveInPixelsForClick, | 86 prefs::kMaxTouchMoveInPixelsForClick, |
85 prefs::kMinDistanceForPinchScrollInPixels, | 87 prefs::kMinDistanceForPinchScrollInPixels, |
86 prefs::kMinFlickSpeedSquared, | 88 prefs::kMinFlickSpeedSquared, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 125 |
124 void GesturePrefsObserver::Update() { | 126 void GesturePrefsObserver::Update() { |
125 GestureConfiguration::set_fling_acceleration_curve_coefficients(0, | 127 GestureConfiguration::set_fling_acceleration_curve_coefficients(0, |
126 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient0)); | 128 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient0)); |
127 GestureConfiguration::set_fling_acceleration_curve_coefficients(1, | 129 GestureConfiguration::set_fling_acceleration_curve_coefficients(1, |
128 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient1)); | 130 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient1)); |
129 GestureConfiguration::set_fling_acceleration_curve_coefficients(2, | 131 GestureConfiguration::set_fling_acceleration_curve_coefficients(2, |
130 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient2)); | 132 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient2)); |
131 GestureConfiguration::set_fling_acceleration_curve_coefficients(3, | 133 GestureConfiguration::set_fling_acceleration_curve_coefficients(3, |
132 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient3)); | 134 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient3)); |
| 135 GestureConfiguration::set_fling_max_cancel_to_down_time_in_ms( |
| 136 prefs_->GetInteger(prefs::kFlingMaxCancelToDownTimeInMs)); |
| 137 GestureConfiguration::set_fling_max_tap_gap_time_in_ms( |
| 138 prefs_->GetInteger(prefs::kFlingMaxTapGapTimeInMs)); |
133 GestureConfiguration::set_fling_velocity_cap( | 139 GestureConfiguration::set_fling_velocity_cap( |
134 prefs_->GetDouble(prefs::kFlingVelocityCap)); | 140 prefs_->GetDouble(prefs::kFlingVelocityCap)); |
135 GestureConfiguration::set_long_press_time_in_seconds( | 141 GestureConfiguration::set_long_press_time_in_seconds( |
136 prefs_->GetDouble( | 142 prefs_->GetDouble( |
137 prefs::kLongPressTimeInSeconds)); | 143 prefs::kLongPressTimeInSeconds)); |
138 GestureConfiguration::set_semi_long_press_time_in_seconds( | 144 GestureConfiguration::set_semi_long_press_time_in_seconds( |
139 prefs_->GetDouble( | 145 prefs_->GetDouble( |
140 prefs::kSemiLongPressTimeInSeconds)); | 146 prefs::kSemiLongPressTimeInSeconds)); |
141 GestureConfiguration::set_max_distance_for_two_finger_tap_in_pixels( | 147 GestureConfiguration::set_max_distance_for_two_finger_tap_in_pixels( |
142 prefs_->GetDouble( | 148 prefs_->GetDouble( |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 GestureConfiguration::fling_acceleration_curve_coefficients(1), | 251 GestureConfiguration::fling_acceleration_curve_coefficients(1), |
246 PrefServiceSyncable::UNSYNCABLE_PREF); | 252 PrefServiceSyncable::UNSYNCABLE_PREF); |
247 prefs->RegisterDoublePref( | 253 prefs->RegisterDoublePref( |
248 prefs::kFlingAccelerationCurveCoefficient2, | 254 prefs::kFlingAccelerationCurveCoefficient2, |
249 GestureConfiguration::fling_acceleration_curve_coefficients(2), | 255 GestureConfiguration::fling_acceleration_curve_coefficients(2), |
250 PrefServiceSyncable::UNSYNCABLE_PREF); | 256 PrefServiceSyncable::UNSYNCABLE_PREF); |
251 prefs->RegisterDoublePref( | 257 prefs->RegisterDoublePref( |
252 prefs::kFlingAccelerationCurveCoefficient3, | 258 prefs::kFlingAccelerationCurveCoefficient3, |
253 GestureConfiguration::fling_acceleration_curve_coefficients(3), | 259 GestureConfiguration::fling_acceleration_curve_coefficients(3), |
254 PrefServiceSyncable::UNSYNCABLE_PREF); | 260 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 261 prefs->RegisterIntegerPref( |
| 262 prefs::kFlingMaxCancelToDownTimeInMs, |
| 263 GestureConfiguration::fling_max_cancel_to_down_time_in_ms(), |
| 264 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 265 prefs->RegisterIntegerPref( |
| 266 prefs::kFlingMaxTapGapTimeInMs, |
| 267 GestureConfiguration::fling_max_tap_gap_time_in_ms(), |
| 268 PrefServiceSyncable::UNSYNCABLE_PREF); |
255 prefs->RegisterDoublePref( | 269 prefs->RegisterDoublePref( |
256 prefs::kFlingVelocityCap, | 270 prefs::kFlingVelocityCap, |
257 GestureConfiguration::fling_velocity_cap(), | 271 GestureConfiguration::fling_velocity_cap(), |
258 PrefServiceSyncable::UNSYNCABLE_PREF); | 272 PrefServiceSyncable::UNSYNCABLE_PREF); |
259 prefs->RegisterDoublePref( | 273 prefs->RegisterDoublePref( |
260 prefs::kLongPressTimeInSeconds, | 274 prefs::kLongPressTimeInSeconds, |
261 GestureConfiguration::long_press_time_in_seconds(), | 275 GestureConfiguration::long_press_time_in_seconds(), |
262 PrefServiceSyncable::UNSYNCABLE_PREF); | 276 PrefServiceSyncable::UNSYNCABLE_PREF); |
263 prefs->RegisterDoublePref( | 277 prefs->RegisterDoublePref( |
264 prefs::kSemiLongPressTimeInSeconds, | 278 prefs::kSemiLongPressTimeInSeconds, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // Use same gesture preferences on incognito windows. | 367 // Use same gesture preferences on incognito windows. |
354 return true; | 368 return true; |
355 } | 369 } |
356 | 370 |
357 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const { | 371 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const { |
358 // Some tests replace the PrefService of the TestingProfile after the | 372 // Some tests replace the PrefService of the TestingProfile after the |
359 // GesturePrefsObserver has been created, which makes Shutdown() | 373 // GesturePrefsObserver has been created, which makes Shutdown() |
360 // remove the registrar from a non-existent PrefService. | 374 // remove the registrar from a non-existent PrefService. |
361 return true; | 375 return true; |
362 } | 376 } |
OLD | NEW |