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

Side by Side Diff: chrome/browser/resources/settings/controls/settings_checkbox.js

Issue 1369403006: Add cr-policy-network-indicator and add to internet settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Separate policy indicator strings 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 * `settings-checkbox` is a checkbox that controls a supplied preference. 7 * `settings-checkbox` is a checkbox that controls a supplied preference.
8 * 8 *
9 * Example: 9 * Example:
10 * <settings-checkbox pref="{{prefs.settings.enableFoo}}" 10 * <settings-checkbox pref="{{prefs.settings.enableFoo}}"
11 * label="Enable foo setting." subLabel="(bar also)"> 11 * label="Enable foo setting." subLabel="(bar also)">
12 * </settings-checkbox> 12 * </settings-checkbox>
13 * 13 *
14 * @element settings-checkbox 14 * @element settings-checkbox
15 */ 15 */
16 Polymer({ 16 Polymer({
17 is: 'settings-checkbox', 17 is: 'settings-checkbox',
18 18
19 behaviors: [PolicyControllable], 19 behaviors: [CrPolicyPrefBehavior],
20 20
21 properties: { 21 properties: {
22 /** 22 /**
23 * The boolean preference object to control. 23 * The boolean preference object to control.
24 * @type {?chrome.settingsPrivate.PrefObject} 24 * @type {!chrome.settingsPrivate.PrefObject|undefined}
25 */ 25 */
26 pref: { 26 pref: {
27 type: Object, 27 type: Object,
28 notify: true, 28 notify: true,
29 }, 29 },
30 30
31 /** Whether the checkbox should represent the inverted value. */ 31 /** Whether the checkbox should represent the inverted value. */
32 inverted: { 32 inverted: {
33 type: Boolean, 33 type: Boolean,
34 value: false, 34 value: false,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 * @param {*} value 94 * @param {*} value
95 * @return {boolean} The value as a boolean, inverted if |inverted| is true. 95 * @return {boolean} The value as a boolean, inverted if |inverted| is true.
96 * @private 96 * @private
97 */ 97 */
98 getNewValue_: function(value) { 98 getNewValue_: function(value) {
99 return this.inverted ? !value : !!value; 99 return this.inverted ? !value : !!value;
100 }, 100 },
101 101
102 /** 102 /**
103 * @param {boolean} disabled 103 * @param {boolean} disabled
104 * @param {?chrome.settingsPrivate.PrefObject} pref 104 * @param {!chrome.settingsPrivate.PrefObject} pref
105 * @return {boolean} Whether the checkbox should be disabled. 105 * @return {boolean} Whether the checkbox should be disabled.
106 * @private 106 * @private
107 */ 107 */
108 checkboxDisabled_: function(disabled, pref) { 108 checkboxDisabled_: function(disabled, pref) {
109 return disabled || this.isPolicyControlled(pref); 109 return disabled || this.isPrefPolicyControlled(pref);
110 }, 110 },
111 }); 111 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698