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

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

Issue 313473002: Remove gesture configuration from about://gesture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reference bug to remove deprecated prefs. Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/prefs/pref_change_registrar.h" 12 #include "base/prefs/pref_change_registrar.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/profiles/incognito_helpers.h" 15 #include "chrome/browser/profiles/incognito_helpers.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "components/keyed_service/content/browser_context_dependency_manager.h" 18 #include "components/keyed_service/content/browser_context_dependency_manager.h"
19 #include "components/pref_registry/pref_registry_syncable.h" 19 #include "components/pref_registry/pref_registry_syncable.h"
20 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/overscroll_configuration.h" 22 #include "content/public/browser/overscroll_configuration.h"
23 #include "content/public/common/renderer_preferences.h" 23 #include "content/public/common/renderer_preferences.h"
24 #include "ui/events/gestures/gesture_configuration.h" 24 #include "ui/events/gestures/gesture_configuration.h"
25 25
26 using ui::GestureConfiguration; 26 using ui::GestureConfiguration;
27 27
28 namespace { 28 namespace {
29 29
30 // TODO(tdresser): Remove these deprecated prefs in M38. See crbug.com/379912.
31
32 const char kFlingVelocityCap[] = "gesture.fling_velocity_cap";
33 const char kLongPressTimeInSeconds[] =
34 "gesture.long_press_time_in_seconds";
35 const char kMaxDistanceBetweenTapsForDoubleTap[] =
36 "gesture.max_distance_between_taps_for_double_tap";
37 const char kMaxDistanceForTwoFingerTapInPixels[] =
38 "gesture.max_distance_for_two_finger_tap_in_pixels";
39 const char kMaxSecondsBetweenDoubleClick[] =
40 "gesture.max_seconds_between_double_click";
41 const char kMaxSwipeDeviationRatio[] =
42 "gesture.max_swipe_deviation_ratio";
43 const char kMaxTouchDownDurationInSecondsForClick[] =
44 "gesture.max_touch_down_duration_in_seconds_for_click";
45 const char kMaxTouchMoveInPixelsForClick[] =
46 "gesture.max_touch_move_in_pixels_for_click";
47 const char kMinDistanceForPinchScrollInPixels[] =
48 "gesture.min_distance_for_pinch_scroll_in_pixels";
49 const char kMinFlickSpeedSquared[] =
50 "gesture.min_flick_speed_squared";
51 const char kMinPinchUpdateDistanceInPixels[] =
52 "gesture.min_pinch_update_distance_in_pixels";
53 const char kMinRailBreakVelocity[] =
54 "gesture.min_rail_break_velocity";
55 const char kMinScrollDeltaSquared[] =
56 "gesture.min_scroll_delta_squared";
57 const char kMinSwipeSpeed[] =
58 "gesture.min_swipe_speed";
59 const char kMinTouchDownDurationInSecondsForClick[] =
60 "gesture.min_touch_down_duration_in_seconds_for_click";
61 const char kPointsBufferedForVelocity[] =
62 "gesture.points_buffered_for_velocity";
63 const char kRailBreakProportion[] =
64 "gesture.rail_break_proportion";
65 const char kRailStartProportion[] =
66 "gesture.rail_start_proportion";
67 const char kScrollPredictionSeconds[] =
68 "gesture.scroll_prediction_seconds";
69 const char kShowPressDelayInMS[] =
70 "gesture.show_press_delay_in_ms";
71
30 struct OverscrollPref { 72 struct OverscrollPref {
31 const char* pref_name; 73 const char* pref_name;
32 content::OverscrollConfig config; 74 content::OverscrollConfig config;
33 }; 75 };
34 76
35 const std::vector<OverscrollPref>& GetOverscrollPrefs() { 77 const std::vector<OverscrollPref>& GetOverscrollPrefs() {
36 CR_DEFINE_STATIC_LOCAL(std::vector<OverscrollPref>, overscroll_prefs, ()); 78 CR_DEFINE_STATIC_LOCAL(std::vector<OverscrollPref>, overscroll_prefs, ());
37 if (overscroll_prefs.empty()) { 79 if (overscroll_prefs.empty()) {
38 using namespace content; 80 using namespace content;
39 const OverscrollPref kOverscrollPrefs[] = { 81 const OverscrollPref kOverscrollPrefs[] = {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Note that this collection of settings should correspond to the settings used 133 // Note that this collection of settings should correspond to the settings used
92 // in ui/events/gestures/gesture_configuration.h 134 // in ui/events/gestures/gesture_configuration.h
93 const char* kPrefsToObserve[] = { 135 const char* kPrefsToObserve[] = {
94 prefs::kFlingAccelerationCurveCoefficient0, 136 prefs::kFlingAccelerationCurveCoefficient0,
95 prefs::kFlingAccelerationCurveCoefficient1, 137 prefs::kFlingAccelerationCurveCoefficient1,
96 prefs::kFlingAccelerationCurveCoefficient2, 138 prefs::kFlingAccelerationCurveCoefficient2,
97 prefs::kFlingAccelerationCurveCoefficient3, 139 prefs::kFlingAccelerationCurveCoefficient3,
98 prefs::kFlingMaxCancelToDownTimeInMs, 140 prefs::kFlingMaxCancelToDownTimeInMs,
99 prefs::kFlingMaxTapGapTimeInMs, 141 prefs::kFlingMaxTapGapTimeInMs,
100 prefs::kTabScrubActivationDelayInMS, 142 prefs::kTabScrubActivationDelayInMS,
101 prefs::kFlingVelocityCap,
102 prefs::kLongPressTimeInSeconds,
103 prefs::kMaxDistanceForTwoFingerTapInPixels,
104 prefs::kMaxSecondsBetweenDoubleClick,
105 prefs::kMaxSeparationForGestureTouchesInPixels, 143 prefs::kMaxSeparationForGestureTouchesInPixels,
106 prefs::kMaxSwipeDeviationRatio,
107 prefs::kMaxTouchDownDurationInSecondsForClick,
108 prefs::kMaxTouchMoveInPixelsForClick,
109 prefs::kMinDistanceForPinchScrollInPixels,
110 prefs::kMinFlickSpeedSquared,
111 prefs::kMinPinchUpdateDistanceInPixels,
112 prefs::kMinRailBreakVelocity,
113 prefs::kMinScrollDeltaSquared,
114 prefs::kMinSwipeSpeed,
115 prefs::kMinTouchDownDurationInSecondsForClick,
116 prefs::kPointsBufferedForVelocity,
117 prefs::kRailBreakProportion,
118 prefs::kRailStartProportion,
119 prefs::kSemiLongPressTimeInSeconds, 144 prefs::kSemiLongPressTimeInSeconds,
120 prefs::kShowPressDelayInMS,
121 }; 145 };
122 146
123 const char* kFlingTouchpadPrefs[] = { 147 const char* kFlingTouchpadPrefs[] = {
124 prefs::kFlingCurveTouchpadAlpha, 148 prefs::kFlingCurveTouchpadAlpha,
125 prefs::kFlingCurveTouchpadBeta, 149 prefs::kFlingCurveTouchpadBeta,
126 prefs::kFlingCurveTouchpadGamma 150 prefs::kFlingCurveTouchpadGamma
127 }; 151 };
128 152
129 const char* kFlingTouchscreenPrefs[] = { 153 const char* kFlingTouchscreenPrefs[] = {
130 prefs::kFlingCurveTouchscreenAlpha, 154 prefs::kFlingCurveTouchscreenAlpha,
131 prefs::kFlingCurveTouchscreenBeta, 155 prefs::kFlingCurveTouchscreenBeta,
132 prefs::kFlingCurveTouchscreenGamma, 156 prefs::kFlingCurveTouchscreenGamma,
133 }; 157 };
134 158
135 GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs) 159 GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs)
136 : prefs_(prefs) { 160 : prefs_(prefs) {
161 // Clear for migration.
162 prefs->ClearPref(kFlingVelocityCap);
163 prefs->ClearPref(kLongPressTimeInSeconds);
164 prefs->ClearPref(kMaxDistanceBetweenTapsForDoubleTap);
165 prefs->ClearPref(kMaxDistanceForTwoFingerTapInPixels);
166 prefs->ClearPref(kMaxSecondsBetweenDoubleClick);
167 prefs->ClearPref(kMaxSwipeDeviationRatio);
168 prefs->ClearPref(kMaxTouchDownDurationInSecondsForClick);
169 prefs->ClearPref(kMaxTouchMoveInPixelsForClick);
170 prefs->ClearPref(kMinDistanceForPinchScrollInPixels);
171 prefs->ClearPref(kMinFlickSpeedSquared);
172 prefs->ClearPref(kMinPinchUpdateDistanceInPixels);
173 prefs->ClearPref(kMinRailBreakVelocity);
174 prefs->ClearPref(kMinScrollDeltaSquared);
175 prefs->ClearPref(kMinSwipeSpeed);
176 prefs->ClearPref(kMinTouchDownDurationInSecondsForClick);
177 prefs->ClearPref(kPointsBufferedForVelocity);
178 prefs->ClearPref(kRailBreakProportion);
179 prefs->ClearPref(kRailStartProportion);
180 prefs->ClearPref(kScrollPredictionSeconds);
181 prefs->ClearPref(kShowPressDelayInMS);
sadrul 2014/06/03 10:25:47 1. Maybe you need to FindPreference() first for ea
tdresser 2014/06/03 12:13:04 Registering the prefs to be removed stops the NOTR
182
137 registrar_.Init(prefs); 183 registrar_.Init(prefs);
138 registrar_.RemoveAll(); 184 registrar_.RemoveAll();
139 base::Closure callback = base::Bind(&GesturePrefsObserver::Update, 185 base::Closure callback = base::Bind(&GesturePrefsObserver::Update,
140 base::Unretained(this)); 186 base::Unretained(this));
141 187
142 base::Closure notify_callback = base::Bind(&GesturePrefsObserver::Notify, 188 base::Closure notify_callback = base::Bind(&GesturePrefsObserver::Notify,
143 base::Unretained(this)); 189 base::Unretained(this));
144 190
145 for (size_t i = 0; i < arraysize(kPrefsToObserve); ++i) 191 for (size_t i = 0; i < arraysize(kPrefsToObserve); ++i)
146 registrar_.Add(kPrefsToObserve[i], callback); 192 registrar_.Add(kPrefsToObserve[i], callback);
(...skipping 24 matching lines...) Expand all
171 GestureConfiguration::set_fling_acceleration_curve_coefficients(2, 217 GestureConfiguration::set_fling_acceleration_curve_coefficients(2,
172 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient2)); 218 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient2));
173 GestureConfiguration::set_fling_acceleration_curve_coefficients(3, 219 GestureConfiguration::set_fling_acceleration_curve_coefficients(3,
174 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient3)); 220 prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient3));
175 GestureConfiguration::set_fling_max_cancel_to_down_time_in_ms( 221 GestureConfiguration::set_fling_max_cancel_to_down_time_in_ms(
176 prefs_->GetInteger(prefs::kFlingMaxCancelToDownTimeInMs)); 222 prefs_->GetInteger(prefs::kFlingMaxCancelToDownTimeInMs));
177 GestureConfiguration::set_fling_max_tap_gap_time_in_ms( 223 GestureConfiguration::set_fling_max_tap_gap_time_in_ms(
178 prefs_->GetInteger(prefs::kFlingMaxTapGapTimeInMs)); 224 prefs_->GetInteger(prefs::kFlingMaxTapGapTimeInMs));
179 GestureConfiguration::set_tab_scrub_activation_delay_in_ms( 225 GestureConfiguration::set_tab_scrub_activation_delay_in_ms(
180 prefs_->GetInteger(prefs::kTabScrubActivationDelayInMS)); 226 prefs_->GetInteger(prefs::kTabScrubActivationDelayInMS));
181 GestureConfiguration::set_fling_velocity_cap(
182 prefs_->GetDouble(prefs::kFlingVelocityCap));
183 GestureConfiguration::set_long_press_time_in_seconds(
184 prefs_->GetDouble(
185 prefs::kLongPressTimeInSeconds));
186 GestureConfiguration::set_semi_long_press_time_in_seconds( 227 GestureConfiguration::set_semi_long_press_time_in_seconds(
187 prefs_->GetDouble( 228 prefs_->GetDouble(
188 prefs::kSemiLongPressTimeInSeconds)); 229 prefs::kSemiLongPressTimeInSeconds));
189 GestureConfiguration::set_max_distance_for_two_finger_tap_in_pixels(
190 prefs_->GetDouble(
191 prefs::kMaxDistanceForTwoFingerTapInPixels));
192 GestureConfiguration::set_max_seconds_between_double_click(
193 prefs_->GetDouble(
194 prefs::kMaxSecondsBetweenDoubleClick));
195 GestureConfiguration::set_max_separation_for_gesture_touches_in_pixels( 230 GestureConfiguration::set_max_separation_for_gesture_touches_in_pixels(
196 prefs_->GetDouble( 231 prefs_->GetDouble(
197 prefs::kMaxSeparationForGestureTouchesInPixels)); 232 prefs::kMaxSeparationForGestureTouchesInPixels));
198 GestureConfiguration::set_max_swipe_deviation_ratio(
199 prefs_->GetDouble(
200 prefs::kMaxSwipeDeviationRatio));
201 GestureConfiguration::set_max_touch_down_duration_in_seconds_for_click(
202 prefs_->GetDouble(
203 prefs::kMaxTouchDownDurationInSecondsForClick));
204 GestureConfiguration::set_max_touch_move_in_pixels_for_click(
205 prefs_->GetDouble(
206 prefs::kMaxTouchMoveInPixelsForClick));
207 GestureConfiguration::set_max_distance_between_taps_for_double_tap(
208 prefs_->GetDouble(
209 prefs::kMaxDistanceBetweenTapsForDoubleTap));
210 GestureConfiguration::set_min_distance_for_pinch_scroll_in_pixels(
211 prefs_->GetDouble(
212 prefs::kMinDistanceForPinchScrollInPixels));
213 GestureConfiguration::set_min_flick_speed_squared(
214 prefs_->GetDouble(
215 prefs::kMinFlickSpeedSquared));
216 GestureConfiguration::set_min_pinch_update_distance_in_pixels(
217 prefs_->GetDouble(
218 prefs::kMinPinchUpdateDistanceInPixels));
219 GestureConfiguration::set_min_rail_break_velocity(
220 prefs_->GetDouble(
221 prefs::kMinRailBreakVelocity));
222 GestureConfiguration::set_min_scroll_delta_squared(
223 prefs_->GetDouble(
224 prefs::kMinScrollDeltaSquared));
225 GestureConfiguration::set_min_swipe_speed(
226 prefs_->GetDouble(
227 prefs::kMinSwipeSpeed));
228 GestureConfiguration::set_min_touch_down_duration_in_seconds_for_click(
229 prefs_->GetDouble(
230 prefs::kMinTouchDownDurationInSecondsForClick));
231 GestureConfiguration::set_points_buffered_for_velocity(
232 prefs_->GetInteger(
233 prefs::kPointsBufferedForVelocity));
234 GestureConfiguration::set_rail_break_proportion(
235 prefs_->GetDouble(
236 prefs::kRailBreakProportion));
237 GestureConfiguration::set_rail_start_proportion(
238 prefs_->GetDouble(
239 prefs::kRailStartProportion));
240 GestureConfiguration::set_scroll_prediction_seconds(
241 prefs_->GetDouble(prefs::kScrollPredictionSeconds));
242 GestureConfiguration::set_show_press_delay_in_ms(
243 prefs_->GetInteger(prefs::kShowPressDelayInMS));
244 233
245 UpdateOverscrollPrefs(); 234 UpdateOverscrollPrefs();
246 } 235 }
247 236
248 void GesturePrefsObserver::UpdateOverscrollPrefs() { 237 void GesturePrefsObserver::UpdateOverscrollPrefs() {
249 const std::vector<OverscrollPref>& overscroll_prefs = GetOverscrollPrefs(); 238 const std::vector<OverscrollPref>& overscroll_prefs = GetOverscrollPrefs();
250 for (size_t i = 0; i < overscroll_prefs.size(); ++i) { 239 for (size_t i = 0; i < overscroll_prefs.size(); ++i) {
251 content::SetOverscrollConfig(overscroll_prefs[i].config, 240 content::SetOverscrollConfig(overscroll_prefs[i].config,
252 static_cast<float>(prefs_->GetDouble(overscroll_prefs[i].pref_name))); 241 static_cast<float>(prefs_->GetDouble(overscroll_prefs[i].pref_name)));
253 } 242 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 324 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
336 registry->RegisterIntegerPref( 325 registry->RegisterIntegerPref(
337 prefs::kFlingMaxTapGapTimeInMs, 326 prefs::kFlingMaxTapGapTimeInMs,
338 GestureConfiguration::fling_max_tap_gap_time_in_ms(), 327 GestureConfiguration::fling_max_tap_gap_time_in_ms(),
339 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 328 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
340 registry->RegisterIntegerPref( 329 registry->RegisterIntegerPref(
341 prefs::kTabScrubActivationDelayInMS, 330 prefs::kTabScrubActivationDelayInMS,
342 GestureConfiguration::tab_scrub_activation_delay_in_ms(), 331 GestureConfiguration::tab_scrub_activation_delay_in_ms(),
343 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 332 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
344 registry->RegisterDoublePref( 333 registry->RegisterDoublePref(
345 prefs::kFlingVelocityCap,
346 GestureConfiguration::fling_velocity_cap(),
347 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
348 registry->RegisterDoublePref(
349 prefs::kLongPressTimeInSeconds,
350 GestureConfiguration::long_press_time_in_seconds(),
351 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
352 registry->RegisterDoublePref(
353 prefs::kSemiLongPressTimeInSeconds, 334 prefs::kSemiLongPressTimeInSeconds,
354 GestureConfiguration::semi_long_press_time_in_seconds(), 335 GestureConfiguration::semi_long_press_time_in_seconds(),
355 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 336 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
356 registry->RegisterDoublePref( 337 registry->RegisterDoublePref(
357 prefs::kMaxDistanceForTwoFingerTapInPixels, 338 prefs::kMaxSeparationForGestureTouchesInPixels,
339 GestureConfiguration::max_separation_for_gesture_touches_in_pixels(),
340 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
341 RegisterOverscrollPrefs(registry);
342 RegisterFlingCurveParameters(registry);
343
344 // Register for migration.
345 registry->RegisterDoublePref(
sadrul 2014/06/03 10:25:47 Why register these anymore?
tdresser 2014/06/03 12:13:04 Hmmm, I was using http://src.chromium.org/viewvc/c
346 kFlingVelocityCap,
347 GestureConfiguration::fling_velocity_cap(),
348 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
349 registry->RegisterDoublePref(
350 kLongPressTimeInSeconds,
351 GestureConfiguration::long_press_time_in_seconds(),
352 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
353 registry->RegisterDoublePref(
354 kMaxDistanceForTwoFingerTapInPixels,
358 GestureConfiguration::max_distance_for_two_finger_tap_in_pixels(), 355 GestureConfiguration::max_distance_for_two_finger_tap_in_pixels(),
359 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 356 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
360 registry->RegisterDoublePref( 357 registry->RegisterDoublePref(
361 prefs::kMaxSecondsBetweenDoubleClick, 358 kMaxSecondsBetweenDoubleClick,
362 GestureConfiguration::max_seconds_between_double_click(), 359 GestureConfiguration::max_seconds_between_double_click(),
363 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 360 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
364 registry->RegisterDoublePref( 361 registry->RegisterDoublePref(
365 prefs::kMaxSeparationForGestureTouchesInPixels, 362 kMaxSwipeDeviationRatio,
366 GestureConfiguration::max_separation_for_gesture_touches_in_pixels(),
367 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
368 registry->RegisterDoublePref(
369 prefs::kMaxSwipeDeviationRatio,
370 GestureConfiguration::max_swipe_deviation_ratio(), 363 GestureConfiguration::max_swipe_deviation_ratio(),
371 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 364 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
372 registry->RegisterDoublePref( 365 registry->RegisterDoublePref(
373 prefs::kMaxTouchDownDurationInSecondsForClick, 366 kMaxTouchDownDurationInSecondsForClick,
374 GestureConfiguration::max_touch_down_duration_in_seconds_for_click(), 367 GestureConfiguration::max_touch_down_duration_in_seconds_for_click(),
375 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 368 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
376 registry->RegisterDoublePref( 369 registry->RegisterDoublePref(
377 prefs::kMaxTouchMoveInPixelsForClick, 370 kMaxTouchMoveInPixelsForClick,
378 GestureConfiguration::max_touch_move_in_pixels_for_click(), 371 GestureConfiguration::max_touch_move_in_pixels_for_click(),
379 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 372 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
380 registry->RegisterDoublePref( 373 registry->RegisterDoublePref(
381 prefs::kMaxDistanceBetweenTapsForDoubleTap, 374 kMaxDistanceBetweenTapsForDoubleTap,
382 GestureConfiguration::max_distance_between_taps_for_double_tap(), 375 GestureConfiguration::max_distance_between_taps_for_double_tap(),
383 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 376 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
384 registry->RegisterDoublePref( 377 registry->RegisterDoublePref(
385 prefs::kMinDistanceForPinchScrollInPixels, 378 kMinDistanceForPinchScrollInPixels,
386 GestureConfiguration::min_distance_for_pinch_scroll_in_pixels(), 379 GestureConfiguration::min_distance_for_pinch_scroll_in_pixels(),
387 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 380 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
388 registry->RegisterDoublePref( 381 registry->RegisterDoublePref(
389 prefs::kMinFlickSpeedSquared, 382 kMinFlickSpeedSquared,
390 GestureConfiguration::min_flick_speed_squared(), 383 GestureConfiguration::min_flick_speed_squared(),
391 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 384 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
392 registry->RegisterDoublePref( 385 registry->RegisterDoublePref(
393 prefs::kMinPinchUpdateDistanceInPixels, 386 kMinPinchUpdateDistanceInPixels,
394 GestureConfiguration::min_pinch_update_distance_in_pixels(), 387 GestureConfiguration::min_pinch_update_distance_in_pixels(),
395 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 388 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
396 registry->RegisterDoublePref( 389 registry->RegisterDoublePref(
397 prefs::kMinRailBreakVelocity, 390 kMinRailBreakVelocity,
398 GestureConfiguration::min_rail_break_velocity(), 391 GestureConfiguration::min_rail_break_velocity(),
399 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 392 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
400 registry->RegisterDoublePref( 393 registry->RegisterDoublePref(
401 prefs::kMinScrollDeltaSquared, 394 kMinScrollDeltaSquared,
402 GestureConfiguration::min_scroll_delta_squared(), 395 GestureConfiguration::min_scroll_delta_squared(),
403 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 396 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
404 registry->RegisterDoublePref( 397 registry->RegisterDoublePref(
405 prefs::kMinSwipeSpeed, 398 kMinSwipeSpeed,
406 GestureConfiguration::min_swipe_speed(), 399 GestureConfiguration::min_swipe_speed(),
407 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 400 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
408 registry->RegisterDoublePref( 401 registry->RegisterDoublePref(
409 prefs::kMinTouchDownDurationInSecondsForClick, 402 kMinTouchDownDurationInSecondsForClick,
410 GestureConfiguration::min_touch_down_duration_in_seconds_for_click(), 403 GestureConfiguration::min_touch_down_duration_in_seconds_for_click(),
411 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 404 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
412 registry->RegisterIntegerPref( 405 registry->RegisterIntegerPref(
413 prefs::kPointsBufferedForVelocity, 406 kPointsBufferedForVelocity,
414 GestureConfiguration::points_buffered_for_velocity(), 407 GestureConfiguration::points_buffered_for_velocity(),
415 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 408 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
416 registry->RegisterDoublePref( 409 registry->RegisterDoublePref(
417 prefs::kRailBreakProportion, 410 kRailBreakProportion,
418 GestureConfiguration::rail_break_proportion(), 411 GestureConfiguration::rail_break_proportion(),
419 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 412 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
420 registry->RegisterDoublePref( 413 registry->RegisterDoublePref(
421 prefs::kRailStartProportion, 414 kRailStartProportion,
422 GestureConfiguration::rail_start_proportion(), 415 GestureConfiguration::rail_start_proportion(),
423 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 416 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
424 registry->RegisterDoublePref( 417 registry->RegisterDoublePref(
425 prefs::kScrollPredictionSeconds, 418 kScrollPredictionSeconds,
426 GestureConfiguration::scroll_prediction_seconds(), 419 GestureConfiguration::scroll_prediction_seconds(),
427 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 420 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
428 registry->RegisterIntegerPref( 421 registry->RegisterIntegerPref(
429 prefs::kShowPressDelayInMS, 422 kShowPressDelayInMS,
430 GestureConfiguration::show_press_delay_in_ms(), 423 GestureConfiguration::show_press_delay_in_ms(),
431 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 424 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
432 RegisterOverscrollPrefs(registry);
433 RegisterFlingCurveParameters(registry);
434 } 425 }
435 426
436 bool 427 bool
437 GesturePrefsObserverFactoryAura::ServiceIsCreatedWithBrowserContext() const { 428 GesturePrefsObserverFactoryAura::ServiceIsCreatedWithBrowserContext() const {
438 // Create the observer as soon as the profile is created. 429 // Create the observer as soon as the profile is created.
439 return true; 430 return true;
440 } 431 }
441 432
442 content::BrowserContext* 433 content::BrowserContext*
443 GesturePrefsObserverFactoryAura::GetBrowserContextToUse( 434 GesturePrefsObserverFactoryAura::GetBrowserContextToUse(
444 content::BrowserContext* context) const { 435 content::BrowserContext* context) const {
445 // Use same gesture preferences on incognito windows. 436 // Use same gesture preferences on incognito windows.
446 return chrome::GetBrowserContextRedirectedInIncognito(context); 437 return chrome::GetBrowserContextRedirectedInIncognito(context);
447 } 438 }
448 439
449 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const { 440 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const {
450 // Some tests replace the PrefService of the TestingProfile after the 441 // Some tests replace the PrefService of the TestingProfile after the
451 // GesturePrefsObserver has been created, which makes Shutdown() 442 // GesturePrefsObserver has been created, which makes Shutdown()
452 // remove the registrar from a non-existent PrefService. 443 // remove the registrar from a non-existent PrefService.
453 return true; 444 return true;
454 } 445 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/gesture_config.js ('k') | chrome/browser/ui/webui/chromeos/salsa_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698