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

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

Issue 2669073002: MD Settings: Allow controlled-button to be used with icons. (Closed)
Patch Set: have the parent row of the controlled-button disable/enable based on controlled-button state Created 3 years, 10 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 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, 9 CrPolicyIndicatorBehavior,
10 CrPolicyPrefBehavior, 10 CrPolicyPrefBehavior,
11 PrefControlBehavior, 11 PrefControlBehavior,
12 ], 12 ],
13 13
14 properties: { 14 properties: {
15 endJustified: { 15 endJustified: {
16 type: Boolean, 16 type: Boolean,
17 value: false, 17 value: false,
18 reflectToAttribute: true, 18 reflectToAttribute: true,
19 }, 19 },
20 20
21 /**
22 * This attribute takes in a class-name to form an icon button instead of
23 * a paper-button. Note that if this attribute is present, the light dom
24 * content will be ignored.
25 */
26 iconClass: {
27 type: String,
28 value: null,
29 reflectToAttribute: true,
30 },
31
21 /** @private */ 32 /** @private */
22 controlled_: { 33 controlled: {
23 type: Boolean, 34 type: Boolean,
24 computed: 'computeControlled_(pref.*)', 35 computed: 'computeControlled_(pref.*)',
25 reflectToAttribute: true, 36 reflectToAttribute: true,
37 notify: true
26 }, 38 },
27 }, 39 },
28 40
29 /** 41 /**
30 * @return {boolean} Whether the button is disabled. 42 * @return {boolean} Whether the button is disabled.
31 * @private 43 * @private
32 */ 44 */
33 computeControlled_: function() { 45 computeControlled_: function() {
34 return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED; 46 return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED;
35 }, 47 },
(...skipping 13 matching lines...) Expand all
49 * @return {boolean} Whether to show a controlled by indicator. 61 * @return {boolean} Whether to show a controlled by indicator.
50 * @private 62 * @private
51 */ 63 */
52 showIndicator_: function(pref) { 64 showIndicator_: function(pref) {
53 if (!pref.controlledBy || !pref.enforcement) 65 if (!pref.controlledBy || !pref.enforcement)
54 return false; 66 return false;
55 var indicator = this.getIndicatorType(pref.controlledBy, pref.enforcement); 67 var indicator = this.getIndicatorType(pref.controlledBy, pref.enforcement);
56 return this.isIndicatorVisible(indicator); 68 return this.isIndicatorVisible(indicator);
57 }, 69 },
58 }); 70 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698