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 | 6 |
7 var Preferences = options.Preferences; | 7 var Preferences = options.Preferences; |
8 | 8 |
9 /** | 9 /** |
10 * Allows an element to be disabled for several reasons. | 10 * Allows an element to be disabled for several reasons. |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 PrefCheckbox.prototype = { | 153 PrefCheckbox.prototype = { |
154 // Set up the prototype chain | 154 // Set up the prototype chain |
155 __proto__: PrefInputElement.prototype, | 155 __proto__: PrefInputElement.prototype, |
156 | 156 |
157 /** | 157 /** |
158 * Initialization function for the cr.ui framework. | 158 * Initialization function for the cr.ui framework. |
159 */ | 159 */ |
160 decorate: function() { | 160 decorate: function() { |
161 PrefInputElement.prototype.decorate.call(this); | 161 PrefInputElement.prototype.decorate.call(this); |
162 this.type = 'checkbox'; | 162 this.type = 'checkbox'; |
163 | |
164 // Prime the checkbox pref, as it may be default-checked. | |
Dan Beam
2014/03/27 21:06:43
i have no idea what this means.
rpetterson
2014/03/27 21:26:00
The preference may be default true.
Dan Beam
2014/03/28 00:00:41
just remove the comment, imo
rpetterson
2014/03/28 00:05:35
Done.
| |
165 if (this.dialogPref) | |
166 this.updatePrefFromState_(); | |
163 }, | 167 }, |
164 | 168 |
165 /** | 169 /** |
166 * Update the associated pref when when the user makes changes to the | 170 * Update the associated pref when when the user makes changes to the |
167 * checkbox state. | 171 * checkbox state. |
168 * @private | 172 * @private |
169 */ | 173 */ |
170 updatePrefFromState_: function() { | 174 updatePrefFromState_: function() { |
171 var value = this.inverted_pref ? !this.checked : this.checked; | 175 var value = this.inverted_pref ? !this.checked : this.checked; |
172 Preferences.setBooleanPref(this.pref, value, | 176 Preferences.setBooleanPref(this.pref, value, |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 PrefNumber: PrefNumber, | 552 PrefNumber: PrefNumber, |
549 PrefRadio: PrefRadio, | 553 PrefRadio: PrefRadio, |
550 PrefRange: PrefRange, | 554 PrefRange: PrefRange, |
551 PrefSelect: PrefSelect, | 555 PrefSelect: PrefSelect, |
552 PrefTextField: PrefTextField, | 556 PrefTextField: PrefTextField, |
553 PrefPortNumber: PrefPortNumber, | 557 PrefPortNumber: PrefPortNumber, |
554 PrefButton: PrefButton | 558 PrefButton: PrefButton |
555 }; | 559 }; |
556 | 560 |
557 }); | 561 }); |
OLD | NEW |