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-button', | 6 is: 'controlled-button', |
7 | 7 |
8 behaviors: [ | 8 behaviors: [ |
9 CrPolicyPrefBehavior, | 9 CrPolicyPrefBehavior, |
10 PrefControlBehavior, | 10 PrefControlBehavior, |
11 ], | 11 ], |
12 | 12 |
13 properties: { | 13 properties: { |
14 endJustified: { | 14 endJustified: { |
15 type: Boolean, | 15 type: Boolean, |
16 value: false, | 16 value: false, |
17 reflectToAttribute: true, | 17 reflectToAttribute: true, |
18 }, | 18 }, |
19 | 19 |
| 20 label: String, |
| 21 |
20 /** @private */ | 22 /** @private */ |
21 controlled_: { | 23 controlled_: { |
22 type: Boolean, | 24 type: Boolean, |
23 computed: 'computeControlled_(pref.*)', | 25 computed: 'computeControlled_(pref.*)', |
24 reflectToAttribute: true, | 26 reflectToAttribute: true, |
25 }, | 27 }, |
26 }, | 28 }, |
27 | 29 |
28 /** | 30 /** |
29 * @return {boolean} Whether the button is disabled. | 31 * @return {boolean} Whether the button is disabled. |
30 * @private | 32 * @private |
31 */ | 33 */ |
32 computeControlled_: function() { | 34 computeControlled_: function() { |
33 return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED; | 35 return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED; |
34 }, | 36 }, |
35 | 37 |
36 /** | 38 /** |
37 * @param {!Event} e | 39 * @param {!Event} e |
38 * @private | 40 * @private |
39 */ | 41 */ |
40 onIndicatorTap_: function(e) { | 42 onIndicatorTap_: function(e) { |
41 // Disallow <controlled-button on-tap="..."> when controlled. | 43 // Disallow <controlled-button on-tap="..."> when controlled. |
42 e.preventDefault(); | 44 e.preventDefault(); |
43 e.stopPropagation(); | 45 e.stopPropagation(); |
44 }, | 46 }, |
45 }); | 47 }); |
OLD | NEW |