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

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

Issue 11299276: Bound the maximum touchscreen fling velocity. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review nits Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/gesture_config.js ('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 "base/prefs/public/pref_change_registrar.h" 8 #include "base/prefs/public/pref_change_registrar.h"
9 #include "base/prefs/public/pref_observer.h" 9 #include "base/prefs/public/pref_observer.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 }; 71 };
72 72
73 // The list of prefs we want to observe. 73 // The list of prefs we want to observe.
74 // Note that this collection of settings should correspond to the settings used 74 // Note that this collection of settings should correspond to the settings used
75 // in ui/base/gestures/gesture_configuration.h 75 // in ui/base/gestures/gesture_configuration.h
76 const char* kPrefsToObserve[] = { 76 const char* kPrefsToObserve[] = {
77 prefs::kFlingAccelerationCurveCoefficient0, 77 prefs::kFlingAccelerationCurveCoefficient0,
78 prefs::kFlingAccelerationCurveCoefficient1, 78 prefs::kFlingAccelerationCurveCoefficient1,
79 prefs::kFlingAccelerationCurveCoefficient2, 79 prefs::kFlingAccelerationCurveCoefficient2,
80 prefs::kFlingAccelerationCurveCoefficient3, 80 prefs::kFlingAccelerationCurveCoefficient3,
81 prefs::kFlingVelocityCap,
81 prefs::kLongPressTimeInSeconds, 82 prefs::kLongPressTimeInSeconds,
82 prefs::kMaxDistanceForTwoFingerTapInPixels, 83 prefs::kMaxDistanceForTwoFingerTapInPixels,
83 prefs::kMaxSecondsBetweenDoubleClick, 84 prefs::kMaxSecondsBetweenDoubleClick,
84 prefs::kMaxSeparationForGestureTouchesInPixels, 85 prefs::kMaxSeparationForGestureTouchesInPixels,
85 prefs::kMaxSwipeDeviationRatio, 86 prefs::kMaxSwipeDeviationRatio,
86 prefs::kMaxTouchDownDurationInSecondsForClick, 87 prefs::kMaxTouchDownDurationInSecondsForClick,
87 prefs::kMaxTouchMoveInPixelsForClick, 88 prefs::kMaxTouchMoveInPixelsForClick,
88 prefs::kMinDistanceForPinchScrollInPixels, 89 prefs::kMinDistanceForPinchScrollInPixels,
89 prefs::kMinFlickSpeedSquared, 90 prefs::kMinFlickSpeedSquared,
90 prefs::kMinPinchUpdateDistanceInPixels, 91 prefs::kMinPinchUpdateDistanceInPixels,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 130
130 void GesturePrefsObserver::Update() { 131 void GesturePrefsObserver::Update() {
131 GestureConfiguration::set_fling_acceleration_curve_coefficients(0, 132 GestureConfiguration::set_fling_acceleration_curve_coefficients(0,
132 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient0)); 133 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient0));
133 GestureConfiguration::set_fling_acceleration_curve_coefficients(1, 134 GestureConfiguration::set_fling_acceleration_curve_coefficients(1,
134 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient1)); 135 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient1));
135 GestureConfiguration::set_fling_acceleration_curve_coefficients(2, 136 GestureConfiguration::set_fling_acceleration_curve_coefficients(2,
136 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient2)); 137 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient2));
137 GestureConfiguration::set_fling_acceleration_curve_coefficients(3, 138 GestureConfiguration::set_fling_acceleration_curve_coefficients(3,
138 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient3)); 139 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient3));
140 GestureConfiguration::set_fling_velocity_cap(
141 prefs_->GetDouble(prefs::kFlingVelocityCap));
139 GestureConfiguration::set_long_press_time_in_seconds( 142 GestureConfiguration::set_long_press_time_in_seconds(
140 prefs_->GetDouble( 143 prefs_->GetDouble(
141 prefs::kLongPressTimeInSeconds)); 144 prefs::kLongPressTimeInSeconds));
142 GestureConfiguration::set_semi_long_press_time_in_seconds( 145 GestureConfiguration::set_semi_long_press_time_in_seconds(
143 prefs_->GetDouble( 146 prefs_->GetDouble(
144 prefs::kSemiLongPressTimeInSeconds)); 147 prefs::kSemiLongPressTimeInSeconds));
145 GestureConfiguration::set_max_distance_for_two_finger_tap_in_pixels( 148 GestureConfiguration::set_max_distance_for_two_finger_tap_in_pixels(
146 prefs_->GetDouble( 149 prefs_->GetDouble(
147 prefs::kMaxDistanceForTwoFingerTapInPixels)); 150 prefs::kMaxDistanceForTwoFingerTapInPixels));
148 GestureConfiguration::set_max_seconds_between_double_click( 151 GestureConfiguration::set_max_seconds_between_double_click(
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 PrefService::UNSYNCABLE_PREF); 252 PrefService::UNSYNCABLE_PREF);
250 prefs->RegisterDoublePref( 253 prefs->RegisterDoublePref(
251 prefs::kFlingAccelerationCurveCoefficient2, 254 prefs::kFlingAccelerationCurveCoefficient2,
252 GestureConfiguration::fling_acceleration_curve_coefficients(2), 255 GestureConfiguration::fling_acceleration_curve_coefficients(2),
253 PrefService::UNSYNCABLE_PREF); 256 PrefService::UNSYNCABLE_PREF);
254 prefs->RegisterDoublePref( 257 prefs->RegisterDoublePref(
255 prefs::kFlingAccelerationCurveCoefficient3, 258 prefs::kFlingAccelerationCurveCoefficient3,
256 GestureConfiguration::fling_acceleration_curve_coefficients(3), 259 GestureConfiguration::fling_acceleration_curve_coefficients(3),
257 PrefService::UNSYNCABLE_PREF); 260 PrefService::UNSYNCABLE_PREF);
258 prefs->RegisterDoublePref( 261 prefs->RegisterDoublePref(
262 prefs::kFlingVelocityCap,
263 GestureConfiguration::fling_velocity_cap(),
264 PrefService::UNSYNCABLE_PREF);
265 prefs->RegisterDoublePref(
259 prefs::kLongPressTimeInSeconds, 266 prefs::kLongPressTimeInSeconds,
260 GestureConfiguration::long_press_time_in_seconds(), 267 GestureConfiguration::long_press_time_in_seconds(),
261 PrefService::UNSYNCABLE_PREF); 268 PrefService::UNSYNCABLE_PREF);
262 prefs->RegisterDoublePref( 269 prefs->RegisterDoublePref(
263 prefs::kSemiLongPressTimeInSeconds, 270 prefs::kSemiLongPressTimeInSeconds,
264 GestureConfiguration::semi_long_press_time_in_seconds(), 271 GestureConfiguration::semi_long_press_time_in_seconds(),
265 PrefService::UNSYNCABLE_PREF); 272 PrefService::UNSYNCABLE_PREF);
266 prefs->RegisterDoublePref( 273 prefs->RegisterDoublePref(
267 prefs::kMaxDistanceForTwoFingerTapInPixels, 274 prefs::kMaxDistanceForTwoFingerTapInPixels,
268 GestureConfiguration::max_distance_for_two_finger_tap_in_pixels(), 275 GestureConfiguration::max_distance_for_two_finger_tap_in_pixels(),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // Use same gesture preferences on incognito windows. 359 // Use same gesture preferences on incognito windows.
353 return true; 360 return true;
354 } 361 }
355 362
356 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const { 363 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const {
357 // Some tests replace the PrefService of the TestingProfile after the 364 // Some tests replace the PrefService of the TestingProfile after the
358 // GesturePrefsObserver has been created, which makes Shutdown() 365 // GesturePrefsObserver has been created, which makes Shutdown()
359 // remove the registrar from a non-existent PrefService. 366 // remove the registrar from a non-existent PrefService.
360 return true; 367 return true;
361 } 368 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/gesture_config.js ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698