| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 Polymer({ |
| 6 is: 'controlled-button', |
| 7 |
| 8 behaviors: [CrPolicyPrefBehavior, PrefControlBehavior], |
| 9 |
| 10 properties: { |
| 11 disabled: { |
| 12 type: Boolean, |
| 13 computed: 'computeDisabled_(pref)', |
| 14 reflectToAttribute: true, |
| 15 }, |
| 16 }, |
| 17 |
| 18 /** |
| 19 * @param {!chrome.settingsPrivate.PrefObject} pref |
| 20 * @return {boolean} Whether the button is controlled. |
| 21 * @private |
| 22 */ |
| 23 computeDisabled_: function(pref) { |
| 24 return this.isPrefPolicyControlled(pref); |
| 25 }, |
| 26 |
| 27 /** |
| 28 * @param {!Event} e |
| 29 * @private |
| 30 */ |
| 31 onIndicatorTap_: function(e) { |
| 32 // :host([disabled]) applies pointer-events: none;, but we want mouse hover |
| 33 // on indicators to work. So we selectively re-enable pointer-events on just |
| 34 // the indicator, but disallow taps and clicks from triggering any on-tap on |
| 35 // the host itself (i.e. <controlled-button on-tap="...">). |
| 36 e.preventDefault(); |
| 37 e.stopPropagation(); |
| 38 }, |
| 39 }); |
| OLD | NEW |