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 Behavior for policy controlled settings prefs. | 6 * @fileoverview Behavior for policy controlled settings prefs. |
7 */ | 7 */ |
8 | 8 |
9 /** @polymerBehavior */ | 9 /** @polymerBehavior */ |
10 var CrPolicyPrefBehavior = { | 10 var CrPolicyPrefBehavior = { |
11 properties: { | 11 properties: { |
12 /** | 12 /** |
13 * Showing that an extension is controlling a pref is sometimes done with a | 13 * Showing that an extension is controlling a pref is sometimes done with a |
14 * different UI (e.g. extension-controlled-indicator). In those cases, | 14 * different UI (e.g. extension-controlled-indicator). In those cases, |
15 * avoid showing an (extra) indicator here. | 15 * avoid showing an (extra) indicator here. |
16 * @public | 16 * @public |
17 */ | 17 */ |
18 ignoreExtensions: Boolean, | 18 noExtensionIndicator: Boolean, |
19 }, | 19 }, |
20 | 20 |
21 /** | 21 /** |
22 * Is the |pref| controlled by something that prevents user control of the | 22 * Is the |pref| controlled by something that prevents user control of the |
23 * preference. | 23 * preference. |
24 * @return {boolean} True if |this.pref| is controlled by an enforced policy. | 24 * @return {boolean} True if |this.pref| is controlled by an enforced policy. |
25 */ | 25 */ |
26 isPrefEnforced: function() { | 26 isPrefEnforced: function() { |
27 if (this.ignoreExtensions && | |
28 this.pref.controlledBy == | |
29 chrome.settingsPrivate.ControlledBy.EXTENSION) { | |
30 return false; | |
31 } | |
32 return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED; | 27 return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED; |
33 }, | 28 }, |
34 | 29 |
35 /** | 30 /** |
36 * @return {boolean} True if |this.pref| has a recommended or enforced policy. | 31 * @return {boolean} True if |this.pref| has a recommended or enforced policy. |
37 */ | 32 */ |
38 hasPrefPolicyIndicator: function() { | 33 hasPrefPolicyIndicator: function() { |
| 34 if (this.noExtensionIndicator && |
| 35 this.pref.controlledBy == |
| 36 chrome.settingsPrivate.ControlledBy.EXTENSION) { |
| 37 return false; |
| 38 } |
39 return this.isPrefEnforced() || | 39 return this.isPrefEnforced() || |
40 this.pref.enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED; | 40 this.pref.enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED; |
41 }, | 41 }, |
42 }; | 42 }; |
OLD | NEW |