OLD | NEW |
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 // PrefCheckbox class: | 9 // PrefCheckbox class: |
10 // TODO(jhawkins): Refactor all this copy-pasted code! | 10 // TODO(jhawkins): Refactor all this copy-pasted code! |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 console.error('undefined data type for <select> pref'); | 404 console.error('undefined data type for <select> pref'); |
405 return; | 405 return; |
406 } | 406 } |
407 | 407 |
408 switch(self.dataType) { | 408 switch(self.dataType) { |
409 case 'number': | 409 case 'number': |
410 Preferences.setIntegerPref(self.pref, | 410 Preferences.setIntegerPref(self.pref, |
411 self.options[self.selectedIndex].value, self.metric); | 411 self.options[self.selectedIndex].value, self.metric); |
412 break; | 412 break; |
413 case 'real': | 413 case 'real': |
414 Preferences.setRealPref(self.pref, | 414 Preferences.setDoublePref(self.pref, |
415 self.options[self.selectedIndex].value, self.metric); | 415 self.options[self.selectedIndex].value, self.metric); |
416 break; | 416 break; |
417 case 'boolean': | 417 case 'boolean': |
418 var option = self.options[self.selectedIndex]; | 418 var option = self.options[self.selectedIndex]; |
419 var value = (option.value == 'true') ? true : false; | 419 var value = (option.value == 'true') ? true : false; |
420 Preferences.setBooleanPref(self.pref, value, self.metric); | 420 Preferences.setBooleanPref(self.pref, value, self.metric); |
421 break; | 421 break; |
422 case 'string': | 422 case 'string': |
423 Preferences.setStringPref(self.pref, | 423 Preferences.setStringPref(self.pref, |
424 self.options[self.selectedIndex].value, self.metric); | 424 self.options[self.selectedIndex].value, self.metric); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 PrefCheckbox: PrefCheckbox, | 511 PrefCheckbox: PrefCheckbox, |
512 PrefNumber: PrefNumber, | 512 PrefNumber: PrefNumber, |
513 PrefNumeric: PrefNumeric, | 513 PrefNumeric: PrefNumeric, |
514 PrefRadio: PrefRadio, | 514 PrefRadio: PrefRadio, |
515 PrefRange: PrefRange, | 515 PrefRange: PrefRange, |
516 PrefSelect: PrefSelect, | 516 PrefSelect: PrefSelect, |
517 PrefTextField: PrefTextField | 517 PrefTextField: PrefTextField |
518 }; | 518 }; |
519 | 519 |
520 }); | 520 }); |
OLD | NEW |