Chromium Code Reviews| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 !this.dialogPref, this.metric); | 173 !this.dialogPref, this.metric); |
| 174 }, | 174 }, |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * Update the checkbox state when the associated pref changes. | 177 * Update the checkbox state when the associated pref changes. |
| 178 * @param {Event} event Pref change event. | 178 * @param {Event} event Pref change event. |
| 179 * @private | 179 * @private |
| 180 */ | 180 */ |
| 181 updateStateFromPref_: function(event) { | 181 updateStateFromPref_: function(event) { |
| 182 var value = Boolean(event.value.value); | 182 var value = Boolean(event.value.value); |
| 183 var checked = this.checked; | |
| 183 this.checked = this.inverted_pref ? !value : value; | 184 this.checked = this.inverted_pref ? !value : value; |
| 185 if (checked != this.checked) | |
|
Dan Beam
2013/03/22 00:31:29
arv@: this is mildly alarming
arv (Not doing code reviews)
2013/03/22 14:35:48
Yeah, this is wrong. We already have code in place
| |
| 186 cr.dispatchSimpleEvent(this, 'change', true, true); | |
| 184 }, | 187 }, |
| 185 }; | 188 }; |
| 186 | 189 |
| 187 /** | 190 /** |
| 188 * Whether the mapping between checkbox state and associated pref is inverted. | 191 * Whether the mapping between checkbox state and associated pref is inverted. |
| 189 * @type {boolean} | 192 * @type {boolean} |
| 190 */ | 193 */ |
| 191 cr.defineProperty(PrefCheckbox, 'inverted_pref', cr.PropertyKind.BOOL_ATTR); | 194 cr.defineProperty(PrefCheckbox, 'inverted_pref', cr.PropertyKind.BOOL_ATTR); |
| 192 | 195 |
| 193 ///////////////////////////////////////////////////////////////////////////// | 196 ///////////////////////////////////////////////////////////////////////////// |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 PrefCheckbox: PrefCheckbox, | 520 PrefCheckbox: PrefCheckbox, |
| 518 PrefNumber: PrefNumber, | 521 PrefNumber: PrefNumber, |
| 519 PrefRadio: PrefRadio, | 522 PrefRadio: PrefRadio, |
| 520 PrefRange: PrefRange, | 523 PrefRange: PrefRange, |
| 521 PrefSelect: PrefSelect, | 524 PrefSelect: PrefSelect, |
| 522 PrefTextField: PrefTextField, | 525 PrefTextField: PrefTextField, |
| 523 PrefButton: PrefButton | 526 PrefButton: PrefButton |
| 524 }; | 527 }; |
| 525 | 528 |
| 526 }); | 529 }); |
| OLD | NEW |