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

Side by Side Diff: chrome/browser/resources/settings/internet_page/network_summary_item.js

Issue 2260613003: MD Settings: Intenet: Fix network list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_638377_scrollable_behavior
Patch Set: Rebase + Feedback Created 4 years, 4 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 Polymer element for displaying the network state for a specific 6 * @fileoverview Polymer element for displaying the network state for a specific
7 * type and a list of networks for that type. 7 * type and a list of networks for that type.
8 */ 8 */
9 9
10 /** @typedef {chrome.networkingPrivate.DeviceStateProperties} */ 10 /** @typedef {chrome.networkingPrivate.DeviceStateProperties} */
11 var DeviceStateProperties; 11 var DeviceStateProperties;
12 12
13 Polymer({ 13 Polymer({
14 is: 'network-summary-item', 14 is: 'network-summary-item',
15 15
16 properties: { 16 properties: {
17 /** 17 /** The expanded state of the list of networks. */
18 * True if the list is expanded.
19 */
20 expanded: { 18 expanded: {
21 type: Boolean, 19 type: Boolean,
22 value: false, 20 value: false,
23 observer: 'expandedChanged_', 21 observer: 'expandedChanged_',
24 }, 22 },
25 23
26 /** 24 /**
25 * Whether the list has been expanded. This is used to ensure the
26 * iron-collapse section animates correctly.
27 */
28 wasExpanded: {
29 type: Boolean,
30 value: false,
31 },
32
33 /**
27 * The maximum height in pixels for the list of networks. 34 * The maximum height in pixels for the list of networks.
28 */ 35 */
29 maxHeight: { 36 maxHeight: {
30 type: Number, 37 type: Number,
31 value: 200, 38 value: 200,
32 }, 39 },
33 40
34 /** 41 /**
35 * Device state for the network type. 42 * Device state for the network type.
36 * @type {DeviceStateProperties|undefined} 43 * @type {DeviceStateProperties|undefined}
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 /** 101 /**
95 * @param {DeviceStateProperties|undefined} deviceState 102 * @param {DeviceStateProperties|undefined} deviceState
96 * @return {boolean} Whether or not the device state is enabled. 103 * @return {boolean} Whether or not the device state is enabled.
97 * @private 104 * @private
98 */ 105 */
99 deviceIsEnabled_: function(deviceState) { 106 deviceIsEnabled_: function(deviceState) {
100 return !!deviceState && deviceState.State == 'Enabled'; 107 return !!deviceState && deviceState.State == 'Enabled';
101 }, 108 },
102 109
103 /** 110 /**
111 * @return {boolean} Whether the dom-if for the network list should be true.
112 * The logic here is designed to allow the enclosed content to be stamped
113 * before it is expanded.
114 * @private
115 */
116 networksDomIfIsTrue_() {
117 if (this.expanded == this.wasExpanded)
118 return this.expanded;
119 if (this.expanded) {
120 Polymer.RenderStatus.afterNextRender(this, function() {
121 this.wasExpanded = true;
122 }.bind(this));
123 return true;
124 }
125 return this.wasExpanded;
126 },
127
128 /**
129 * @return {boolean} Whether the iron-collapse for the network list should
130 * be opened.
131 * @private
132 */
133 networksIronCollapseIsOpened_() {
134 return this.expanded && this.wasExpanded;
135 },
136
137 /**
104 * @param {DeviceStateProperties} deviceState 138 * @param {DeviceStateProperties} deviceState
105 * @return {boolean} 139 * @return {boolean}
106 * @private 140 * @private
107 */ 141 */
108 enableIsVisible_: function(deviceState) { 142 enableIsVisible_: function(deviceState) {
109 return !!deviceState && deviceState.Type != CrOnc.Type.ETHERNET && 143 return !!deviceState && deviceState.Type != CrOnc.Type.ETHERNET &&
110 deviceState.Type != CrOnc.Type.VPN; 144 deviceState.Type != CrOnc.Type.VPN;
111 }, 145 },
112 146
113 /** 147 /**
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 210
177 /** 211 /**
178 * Called whenever the 'selectable' state might change. 212 * Called whenever the 'selectable' state might change.
179 * @private 213 * @private
180 */ 214 */
181 updateSelectable_: function() { 215 updateSelectable_: function() {
182 var selectable = this.deviceIsEnabled_(this.deviceState); 216 var selectable = this.deviceIsEnabled_(this.deviceState);
183 this.$.details.classList.toggle('selectable', selectable); 217 this.$.details.classList.toggle('selectable', selectable);
184 }, 218 },
185 }); 219 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698