Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js

Issue 2708013003: [MD settings] show icon when content settings are controlled by an extension (Closed)
Patch Set: unit test fix Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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: {
12 /**
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,
15 * avoid showing an (extra) indicator here.
16 * @public
17 */
18 ignoreExtensions: Boolean,
19 },
20
11 /** 21 /**
22 * Is the |pref| controlled by something that prevents user control of the
23 * preference.
12 * @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.
13 */ 25 */
14 isPrefPolicyControlled: function() { 26 isPrefEnforced: function() {
15 return ( 27 if (this.ignoreExtensions &&
16 this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED && 28 this.pref.controlledBy ==
17 this.pref.controlledBy != 29 chrome.settingsPrivate.ControlledBy.EXTENSION) {
18 chrome.settingsPrivate.ControlledBy.EXTENSION); 30 return false;
31 }
32 return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED;
19 }, 33 },
20 34
21 /** 35 /**
22 * @return {boolean} True if |this.pref| has a recommended or enforced policy. 36 * @return {boolean} True if |this.pref| has a recommended or enforced policy.
23 */ 37 */
24 hasPrefPolicyIndicator: function() { 38 hasPrefPolicyIndicator: function() {
25 return this.isPrefPolicyControlled() || 39 return this.isPrefEnforced() ||
26 this.pref.enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED; 40 this.pref.enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED;
27 }, 41 },
28 }; 42 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698