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 CrPolicyIndicatorBehavior, | |
10 CrPolicyPrefBehavior, | 9 CrPolicyPrefBehavior, |
11 PrefControlBehavior, | 10 PrefControlBehavior, |
12 ], | 11 ], |
13 | 12 |
14 properties: { | 13 properties: { |
15 endJustified: { | 14 endJustified: { |
16 type: Boolean, | 15 type: Boolean, |
17 value: false, | 16 value: false, |
18 reflectToAttribute: true, | 17 reflectToAttribute: true, |
19 }, | 18 }, |
(...skipping 16 matching lines...) Expand all Loading... |
36 | 35 |
37 /** | 36 /** |
38 * @param {!Event} e | 37 * @param {!Event} e |
39 * @private | 38 * @private |
40 */ | 39 */ |
41 onIndicatorTap_: function(e) { | 40 onIndicatorTap_: function(e) { |
42 // Disallow <controlled-button on-tap="..."> when controlled. | 41 // Disallow <controlled-button on-tap="..."> when controlled. |
43 e.preventDefault(); | 42 e.preventDefault(); |
44 e.stopPropagation(); | 43 e.stopPropagation(); |
45 }, | 44 }, |
46 | |
47 /** | |
48 * @param {!chrome.settingsPrivate.PrefObject} pref | |
49 * @return {boolean} Whether to show a controlled by indicator. | |
50 * @private | |
51 */ | |
52 showIndicator_: function(pref) { | |
53 if (!pref.controlledBy || !pref.enforcement) | |
54 return false; | |
55 var indicator = this.getIndicatorType(pref.controlledBy, pref.enforcement); | |
56 return this.isIndicatorVisible(indicator); | |
57 }, | |
58 }); | 45 }); |
OLD | NEW |