| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * `cr-radio-group` wraps a radio-group and set of radio-buttons that control | 7 * `cr-radio-group` wraps a radio-group and set of radio-buttons that control |
| 8 * a supplied preference. | 8 * a supplied preference. |
| 9 * | 9 * |
| 10 * Example: | 10 * Example: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 /** | 21 /** |
| 22 * IronSelectableBehavior selected attribute. | 22 * IronSelectableBehavior selected attribute. |
| 23 */ | 23 */ |
| 24 selected: { | 24 selected: { |
| 25 type: String, | 25 type: String, |
| 26 notify: true, | 26 notify: true, |
| 27 observer: 'selectedChanged_' | 27 observer: 'selectedChanged_' |
| 28 }, | 28 }, |
| 29 }, | 29 }, |
| 30 | 30 |
| 31 hostAttributes: { |
| 32 role: 'none', |
| 33 }, |
| 34 |
| 31 observers: [ | 35 observers: [ |
| 32 'prefChanged_(pref.*)', | 36 'prefChanged_(pref.*)', |
| 33 ], | 37 ], |
| 34 | 38 |
| 35 /** @private */ | 39 /** @private */ |
| 36 prefChanged_: function() { | 40 prefChanged_: function() { |
| 37 var pref = /** @type {!chrome.settingsPrivate.PrefObject} */(this.pref); | 41 var pref = /** @type {!chrome.settingsPrivate.PrefObject} */(this.pref); |
| 38 this.selected = Settings.PrefUtil.prefToString(pref); | 42 this.selected = Settings.PrefUtil.prefToString(pref); |
| 39 }, | 43 }, |
| 40 | 44 |
| 41 /** @private */ | 45 /** @private */ |
| 42 selectedChanged_: function(selected) { | 46 selectedChanged_: function(selected) { |
| 43 if (!this.pref) | 47 if (!this.pref) |
| 44 return; | 48 return; |
| 45 this.set('pref.value', | 49 this.set('pref.value', |
| 46 Settings.PrefUtil.stringToPrefValue(selected, this.pref)); | 50 Settings.PrefUtil.stringToPrefValue(selected, this.pref)); |
| 47 }, | 51 }, |
| 48 }); | 52 }); |
| OLD | NEW |