| OLD | NEW |
| 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} */ |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 expandIsVisible_: function() { | 196 expandIsVisible_: function() { |
| 197 if (!this.deviceIsEnabled_()) | 197 if (!this.deviceIsEnabled_()) |
| 198 return false; | 198 return false; |
| 199 let type = this.deviceState.Type; | 199 let type = this.deviceState.Type; |
| 200 var minLength = | 200 var minLength = |
| 201 (type == CrOnc.Type.WI_FI || type == CrOnc.Type.VPN) ? 1 : 2; | 201 (type == CrOnc.Type.WI_FI || type == CrOnc.Type.VPN) ? 1 : 2; |
| 202 return this.networkStateList.length >= minLength; | 202 return this.networkStateList.length >= minLength; |
| 203 }, | 203 }, |
| 204 | 204 |
| 205 /** | 205 /** |
| 206 * @return {boolean} Whether or not to show the UI to show details. |
| 207 * @private |
| 208 */ |
| 209 showDetailsIsVisible_: function() { |
| 210 if (this.expandIsVisible_()) |
| 211 return false; |
| 212 return this.deviceIsEnabled_(); |
| 213 }, |
| 214 |
| 215 /** |
| 206 * @return {boolean} True if the known networks button should be shown. | 216 * @return {boolean} True if the known networks button should be shown. |
| 207 * @private | 217 * @private |
| 208 */ | 218 */ |
| 209 knownNetworksIsVisible_: function() { | 219 knownNetworksIsVisible_: function() { |
| 210 return !!this.activeNetworkState && | 220 return !!this.activeNetworkState && |
| 211 this.activeNetworkState.Type == CrOnc.Type.WI_FI; | 221 this.activeNetworkState.Type == CrOnc.Type.WI_FI; |
| 212 }, | 222 }, |
| 213 | 223 |
| 214 /** | 224 /** |
| 215 * Event triggered when the details div is tapped or Enter is pressed. | 225 * Event triggered when the details div is tapped or Enter is pressed. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 */ | 267 */ |
| 258 onDeviceEnabledTap_: function(event) { | 268 onDeviceEnabledTap_: function(event) { |
| 259 var deviceIsEnabled = this.deviceIsEnabled_(); | 269 var deviceIsEnabled = this.deviceIsEnabled_(); |
| 260 var type = this.deviceState ? this.deviceState.Type : ''; | 270 var type = this.deviceState ? this.deviceState.Type : ''; |
| 261 this.fire( | 271 this.fire( |
| 262 'device-enabled-toggled', {enabled: !deviceIsEnabled, type: type}); | 272 'device-enabled-toggled', {enabled: !deviceIsEnabled, type: type}); |
| 263 // Make sure this does not propagate to onDetailsTap_. | 273 // Make sure this does not propagate to onDetailsTap_. |
| 264 event.stopPropagation(); | 274 event.stopPropagation(); |
| 265 }, | 275 }, |
| 266 }); | 276 }); |
| OLD | NEW |