OLD | NEW |
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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 var Preferences = options.Preferences; | 6 var Preferences = options.Preferences; |
7 | 7 |
8 /** | 8 /** |
9 * Allows an element to be disabled for several reasons. | 9 * Allows an element to be disabled for several reasons. |
10 * The element is disabled if at least one reason is true, and the reasons | 10 * The element is disabled if at least one reason is true, and the reasons |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 * it, a default handler is invoked that updates the input element's state. | 91 * it, a default handler is invoked that updates the input element's state. |
92 * @param {Event} event Pref change event. | 92 * @param {Event} event Pref change event. |
93 * @protected | 93 * @protected |
94 */ | 94 */ |
95 updateStateFromPref: function(event) { | 95 updateStateFromPref: function(event) { |
96 if (!this.customPrefChangeHandler(event)) | 96 if (!this.customPrefChangeHandler(event)) |
97 this.value = event.value.value; | 97 this.value = event.value.value; |
98 }, | 98 }, |
99 | 99 |
100 /** | 100 /** |
| 101 * An abstract method for all subclasses to override to update their |
| 102 * preference from existing state. |
| 103 * @protected |
| 104 */ |
| 105 updatePrefFromState: assertNotReached, |
| 106 |
| 107 /** |
101 * See |updateDisabledState| above. | 108 * See |updateDisabledState| above. |
102 */ | 109 */ |
103 setDisabled: function(reason, disabled) { | 110 setDisabled: function(reason, disabled) { |
104 updateDisabledState(this, reason, disabled); | 111 updateDisabledState(this, reason, disabled); |
105 }, | 112 }, |
106 | 113 |
107 /** | 114 /** |
108 * Custom change handler that is invoked first when the user makes changes | 115 * Custom change handler that is invoked first when the user makes changes |
109 * to the input element's state. If it returns false, a default handler is | 116 * to the input element's state. If it returns false, a default handler is |
110 * invoked next that updates the associated pref. If it returns true, the | 117 * invoked next that updates the associated pref. If it returns true, the |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 PrefInputElement: PrefInputElement, | 585 PrefInputElement: PrefInputElement, |
579 PrefNumber: PrefNumber, | 586 PrefNumber: PrefNumber, |
580 PrefRadio: PrefRadio, | 587 PrefRadio: PrefRadio, |
581 PrefRange: PrefRange, | 588 PrefRange: PrefRange, |
582 PrefSelect: PrefSelect, | 589 PrefSelect: PrefSelect, |
583 PrefTextField: PrefTextField, | 590 PrefTextField: PrefTextField, |
584 PrefPortNumber: PrefPortNumber, | 591 PrefPortNumber: PrefPortNumber, |
585 PrefButton: PrefButton | 592 PrefButton: PrefButton |
586 }; | 593 }; |
587 }); | 594 }); |
OLD | NEW |