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

Side by Side Diff: chrome/browser/resources/options/pref_ui.js

Issue 6737035: Proxy settings automation hooks and related proxy settings fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix outdated header. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 cr.define('options', function() { 5 cr.define('options', function() {
6 6
7 var Preferences = options.Preferences; 7 var Preferences = options.Preferences;
8 8
9 /** 9 /**
10 * Helper function update element's state from pref change event. 10 * Helper function update element's state from pref change event.
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 function(event) { 474 function(event) {
475 self.value = event.value && event.value['value'] != undefined ? 475 self.value = event.value && event.value['value'] != undefined ?
476 event.value['value'] : event.value; 476 event.value['value'] : event.value;
477 477
478 updateElementState_(self, event); 478 updateElementState_(self, event);
479 }); 479 });
480 480
481 // Listen to user events. 481 // Listen to user events.
482 this.addEventListener('change', 482 this.addEventListener('change',
483 function(e) { 483 function(e) {
484 Preferences.setStringPref(self.pref, self.value, self.metric); 484 switch(self.dataType) {
485 case 'number':
486 Preferences.setIntegerPref(self.pref, parseInt(self.value, 10),
487 self.metric);
488 break;
489 case 'double':
490 Preferences.setDoublePref(self.pref, parseFloat(self.value),
491 self.metric);
492 break;
493 default:
494 Preferences.setStringPref(self.pref, self.value, self.metric);
495 break;
496 }
485 }); 497 });
486 498
487 window.addEventListener('unload', 499 window.addEventListener('unload',
488 function() { 500 function() {
489 if (document.activeElement == self) 501 if (document.activeElement == self)
490 self.blur(); 502 self.blur();
491 }); 503 });
492 } 504 }
493 }; 505 };
494 506
495 /** 507 /**
496 * The preference name. 508 * The preference name.
497 * @type {string} 509 * @type {string}
498 */ 510 */
499 cr.defineProperty(PrefTextField, 'pref', cr.PropertyKind.ATTR); 511 cr.defineProperty(PrefTextField, 'pref', cr.PropertyKind.ATTR);
500 512
501 /** 513 /**
502 * The user metric string. 514 * The user metric string.
503 * @type {string} 515 * @type {string}
504 */ 516 */
505 cr.defineProperty(PrefTextField, 'metric', cr.PropertyKind.ATTR); 517 cr.defineProperty(PrefTextField, 'metric', cr.PropertyKind.ATTR);
506 518
519 /**
520 * The data type for the preference options.
521 * @type {string}
522 */
523 cr.defineProperty(PrefTextField, 'dataType', cr.PropertyKind.ATTR);
524
507 // Export 525 // Export
508 return { 526 return {
509 PrefCheckbox: PrefCheckbox, 527 PrefCheckbox: PrefCheckbox,
510 PrefNumber: PrefNumber, 528 PrefNumber: PrefNumber,
511 PrefNumeric: PrefNumeric, 529 PrefNumeric: PrefNumeric,
512 PrefRadio: PrefRadio, 530 PrefRadio: PrefRadio,
513 PrefRange: PrefRange, 531 PrefRange: PrefRange,
514 PrefSelect: PrefSelect, 532 PrefSelect: PrefSelect,
515 PrefTextField: PrefTextField 533 PrefTextField: PrefTextField
516 }; 534 };
517 535
518 }); 536 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/chromeos/proxy.html ('k') | chrome/test/functional/chromeos_wifi.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698