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

Side by Side Diff: chrome/browser/resources/gesture_config.js

Issue 586933003: fling: Remove a bunch of code for configuring fling curves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 6 years, 3 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) 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 // Redefine '$' here rather than including 'cr.js', since this is 5 // Redefine '$' here rather than including 'cr.js', since this is
6 // the only function needed. This allows this file to be loaded 6 // the only function needed. This allows this file to be loaded
7 // in a browser directly for layout and some testing purposes. 7 // in a browser directly for layout and some testing purposes.
8 var $ = function(id) { return document.getElementById(id); }; 8 var $ = function(id) { return document.getElementById(id); };
9 9
10 /** 10 /**
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 label: 'Semi Long Press Time', 172 label: 'Semi Long Press Time',
173 units: 'seconds', 173 units: 'seconds',
174 step: 0.1 174 step: 0.1
175 }, 175 },
176 { 176 {
177 key: 'max_separation_for_gesture_touches_in_pixels', 177 key: 'max_separation_for_gesture_touches_in_pixels',
178 label: 'Maximum Separation for Gesture Touches', 178 label: 'Maximum Separation for Gesture Touches',
179 units: 'pixels' 179 units: 'pixels'
180 }, 180 },
181 { 181 {
182 key: 'fling_acceleration_curve_coefficient_0',
183 label: 'Touchscreen Fling Acceleration',
184 units: 'x<sup>3</sup>',
185 min: '-1'
186 },
187 {
188 key: 'fling_acceleration_curve_coefficient_1',
189 label: '+',
190 units: 'x<sup>2</sup>',
191 min: '-1'
192 },
193 {
194 key: 'fling_acceleration_curve_coefficient_2',
195 label: '+',
196 units: 'x<sup>1</sup>',
197 min: '-1'
198 },
199 {
200 key: 'fling_acceleration_curve_coefficient_3',
201 label: '+',
202 units: 'x<sup>0</sup>',
203 min: '-1'
204 },
205 {
206 key: 'tab_scrub_activation_delay_in_ms', 182 key: 'tab_scrub_activation_delay_in_ms',
207 label: 'Tab scrub auto activation delay, (-1 for never)', 183 label: 'Tab scrub auto activation delay, (-1 for never)',
208 units: 'milliseconds' 184 units: 'milliseconds'
209 } 185 }
210 ]; 186 ];
211 187
212 return new GeneralConfig(GESTURE_TITLE, GESTURE_PREFIX, GESTURE_FIELDS); 188 return new GeneralConfig(GESTURE_TITLE, GESTURE_PREFIX, GESTURE_FIELDS);
213 } 189 }
214 190
215 /** 191 /**
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 units: 'pixels' 234 units: 'pixels'
259 }, 235 },
260 ]; 236 ];
261 237
262 return new GeneralConfig(OVERSCROLL_TITLE, 238 return new GeneralConfig(OVERSCROLL_TITLE,
263 OVERSCROLL_PREFIX, 239 OVERSCROLL_PREFIX,
264 OVERSCROLL_FIELDS); 240 OVERSCROLL_FIELDS);
265 } 241 }
266 242
267 /** 243 /**
268 * Returns a GeneralConfig for configuring flingcurve.* preferences.
269 * @return {object} A GeneralConfig object.
270 */
271 function FlingConfig() {
272 /** @const */ var FLING_TITLE = 'Fling Configuration';
273
274 /** @const */ var FLING_PREFIX = 'flingcurve.';
275
276 var FLING_FIELDS = [
277 {
278 key: 'touchscreen_alpha',
279 label: 'Touchscreen fling deacceleration coefficients',
280 units: 'alpha',
281 min: '-inf'
282 },
283 {
284 key: 'touchscreen_beta',
285 label: '',
286 units: 'beta',
287 min: '-inf'
288 },
289 {
290 key: 'touchscreen_gamma',
291 label: '',
292 units: 'gamma',
293 min: '-inf'
294 },
295 {
296 key: 'touchpad_alpha',
297 label: 'Touchpad fling deacceleration coefficients',
298 units: 'alpha',
299 min: '-inf'
300 },
301 {
302 key: 'touchpad_beta',
303 label: '',
304 units: 'beta',
305 min: '-inf'
306 },
307 {
308 key: 'touchpad_gamma',
309 label: '',
310 units: 'gamma',
311 min: '-inf'
312 },
313 ];
314
315 return new GeneralConfig(FLING_TITLE, FLING_PREFIX, FLING_FIELDS);
316 }
317
318 /**
319 * WebUI instance for configuring preference values related to gesture input. 244 * WebUI instance for configuring preference values related to gesture input.
320 */ 245 */
321 window.gesture_config = { 246 window.gesture_config = {
322 /** 247 /**
323 * Build and initialize the gesture configuration form. 248 * Build and initialize the gesture configuration form.
324 */ 249 */
325 initialize: function() { 250 initialize: function() {
326 var g = GestureConfig(); 251 var g = GestureConfig();
327 g.buildAll(); 252 g.buildAll();
328 253
329 var o = OverscrollConfig(); 254 var o = OverscrollConfig();
330 o.buildAll(); 255 o.buildAll();
331 256
332 var f = FlingConfig();
333 f.buildAll();
334
335 $('reset-all-button').onclick = function() { 257 $('reset-all-button').onclick = function() {
336 g.onReset(); 258 g.onReset();
337 o.onReset(); 259 o.onReset();
338 f.onReset();
339 }; 260 };
340 }, 261 },
341 262
342 /** 263 /**
343 * Checks if all gesture preferences are set to default by checking the status 264 * Checks if all gesture preferences are set to default by checking the status
344 * of the reset button associated with each preference. 265 * of the reset button associated with each preference.
345 * @return {boolean} True if all gesture preferences are set to default. 266 * @return {boolean} True if all gesture preferences are set to default.
346 */ 267 */
347 areAllPrefsSetToDefault: function() { 268 areAllPrefsSetToDefault: function() {
348 var resets = $('gesture-form').querySelectorAll('.row-reset'); 269 var resets = $('gesture-form').querySelectorAll('.row-reset');
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 */ 312 */
392 updatePreferenceValueResult: function(prefName, value, isDefault) { 313 updatePreferenceValueResult: function(prefName, value, isDefault) {
393 prefName = prefName.substring(prefName.indexOf('.') + 1); 314 prefName = prefName.substring(prefName.indexOf('.') + 1);
394 $(prefName).value = value; 315 $(prefName).value = value;
395 this.updateResetButton($(prefName + '-reset'), isDefault); 316 this.updateResetButton($(prefName + '-reset'), isDefault);
396 this.updateResetAllButton(this.areAllPrefsSetToDefault()); 317 this.updateResetAllButton(this.areAllPrefsSetToDefault());
397 }, 318 },
398 }; 319 };
399 320
400 document.addEventListener('DOMContentLoaded', gesture_config.initialize); 321 document.addEventListener('DOMContentLoaded', gesture_config.initialize);
OLDNEW
« no previous file with comments | « chrome/browser/renderer_preferences_util.cc ('k') | chrome/browser/ui/gesture_prefs_observer_factory_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698