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

Side by Side Diff: chrome/browser/resources/settings/checkbox/checkbox.js

Issue 1358433003: MD Settings: Make PolicyControllable behavior for isPolicyControlled() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: i have brought great shame upon us Created 5 years, 2 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 6 * @fileoverview
7 * `cr-settings-checkbox` is a checkbox that controls a supplied preference. 7 * `cr-settings-checkbox` is a checkbox that controls a supplied preference.
8 * 8 *
9 * Example: 9 * Example:
10 * <cr-settings-checkbox pref="{{prefs.settings.enableFoo}}" 10 * <cr-settings-checkbox pref="{{prefs.settings.enableFoo}}"
11 * label="Enable foo setting." subLabel="(bar also)"> 11 * label="Enable foo setting." subLabel="(bar also)">
12 * </cr-settings-checkbox> 12 * </cr-settings-checkbox>
13 * 13 *
14 * @element cr-settings-checkbox 14 * @element cr-settings-checkbox
15 */ 15 */
16 Polymer({ 16 Polymer({
17 is: 'cr-settings-checkbox', 17 is: 'cr-settings-checkbox',
18 18
19 behaviors: [PolicyControllable],
20
19 properties: { 21 properties: {
20 /** 22 /**
21 * The boolean preference object to control. 23 * The boolean preference object to control.
22 * @type {?chrome.settingsPrivate.PrefObject} 24 * @type {?chrome.settingsPrivate.PrefObject}
23 */ 25 */
24 pref: { 26 pref: {
25 type: Object, 27 type: Object,
26 notify: true, 28 notify: true,
27 }, 29 },
28 30
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return this.inverted ? !value : !!value; 95 return this.inverted ? !value : !!value;
94 }, 96 },
95 97
96 /** 98 /**
97 * @param {boolean} disabled 99 * @param {boolean} disabled
98 * @param {?chrome.settingsPrivate.PrefObject} pref 100 * @param {?chrome.settingsPrivate.PrefObject} pref
99 * @return {boolean} Whether the checkbox should be disabled. 101 * @return {boolean} Whether the checkbox should be disabled.
100 * @private 102 * @private
101 */ 103 */
102 checkboxDisabled_: function(disabled, pref) { 104 checkboxDisabled_: function(disabled, pref) {
103 return disabled || (!!pref && 105 return disabled || this.isPolicyControlled(pref);
104 pref.policyEnforcement ==
105 chrome.settingsPrivate.PolicyEnforcement.ENFORCED);
106 }, 106 },
107 }); 107 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698