Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 Polymer({ | 5 Polymer({ |
| 6 is: 'controlled-radio-button', | 6 is: 'controlled-radio-button', |
| 7 | 7 |
| 8 behaviors: [CrPolicyPrefBehavior, PrefControlBehavior], | 8 behaviors: [CrPolicyPrefBehavior, PrefControlBehavior], |
| 9 | 9 |
| 10 properties: { | 10 properties: { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 listeners: { | 24 listeners: { |
| 25 'focus': 'onFocus_', | 25 'focus': 'onFocus_', |
| 26 }, | 26 }, |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * @return {boolean} Whether the button is disabled. | 29 * @return {boolean} Whether the button is disabled. |
| 30 * @private | 30 * @private |
| 31 */ | 31 */ |
| 32 computeControlled_: function() { | 32 computeControlled_: function() { |
| 33 return this.isPrefPolicyControlled(assert(this.pref)); | 33 return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED; |
|
dpapad
2016/11/18 23:46:28
This is subtle. What is the difference between |pr
Dan Beam
2016/11/18 23:51:04
the code you're looking at is outdated, there's on
dpapad
2016/11/19 00:20:15
Ok. I am slightly confused, so I am going to ask q
Dan Beam
2016/11/19 00:50:05
yes
| |
| 34 }, | 34 }, |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * @param {boolean} controlled | 37 * @param {boolean} controlled |
| 38 * @param {string} name | 38 * @param {string} name |
| 39 * @param {chrome.settingsPrivate.PrefObject} pref | 39 * @param {chrome.settingsPrivate.PrefObject} pref |
| 40 * @return {boolean} | 40 * @return {boolean} |
| 41 * @private | 41 * @private |
| 42 */ | 42 */ |
| 43 showIndicator_: function(controlled, name, pref) { | 43 showIndicator_: function(controlled, name, pref) { |
| 44 return controlled && name == Settings.PrefUtil.prefToString(pref); | 44 return controlled && name == Settings.PrefUtil.prefToString(pref); |
| 45 }, | 45 }, |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * @param {!Event} e | 48 * @param {!Event} e |
| 49 * @private | 49 * @private |
| 50 */ | 50 */ |
| 51 onIndicatorTap_: function(e) { | 51 onIndicatorTap_: function(e) { |
| 52 // Disallow <controlled-radio-button on-tap="..."> when controlled. | 52 // Disallow <controlled-radio-button on-tap="..."> when controlled. |
| 53 e.preventDefault(); | 53 e.preventDefault(); |
| 54 e.stopPropagation(); | 54 e.stopPropagation(); |
| 55 }, | 55 }, |
| 56 | 56 |
| 57 /** Focuses the internal radio button when the row is selected. */ | 57 /** Focuses the internal radio button when the row is selected. */ |
| 58 onFocus_: function() { | 58 onFocus_: function() { |
| 59 this.$.radioButton.focus(); | 59 this.$.radioButton.focus(); |
| 60 }, | 60 }, |
| 61 }); | 61 }); |
| OLD | NEW |