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 if (this.dialogPref) |
| 165 this.updatePrefFromState_(); |
163 }, | 166 }, |
164 | 167 |
165 /** | 168 /** |
166 * Update the associated pref when when the user makes changes to the | 169 * Update the associated pref when when the user makes changes to the |
167 * checkbox state. | 170 * checkbox state. |
168 * @private | 171 * @private |
169 */ | 172 */ |
170 updatePrefFromState_: function() { | 173 updatePrefFromState_: function() { |
171 var value = this.inverted_pref ? !this.checked : this.checked; | 174 var value = this.inverted_pref ? !this.checked : this.checked; |
172 Preferences.setBooleanPref(this.pref, value, | 175 Preferences.setBooleanPref(this.pref, value, |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 PrefNumber: PrefNumber, | 551 PrefNumber: PrefNumber, |
549 PrefRadio: PrefRadio, | 552 PrefRadio: PrefRadio, |
550 PrefRange: PrefRange, | 553 PrefRange: PrefRange, |
551 PrefSelect: PrefSelect, | 554 PrefSelect: PrefSelect, |
552 PrefTextField: PrefTextField, | 555 PrefTextField: PrefTextField, |
553 PrefPortNumber: PrefPortNumber, | 556 PrefPortNumber: PrefPortNumber, |
554 PrefButton: PrefButton | 557 PrefButton: PrefButton |
555 }; | 558 }; |
556 | 559 |
557 }); | 560 }); |
OLD | NEW |