| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 /** | 183 /** |
| 184 * @return {boolean} | 184 * @return {boolean} |
| 185 * @private | 185 * @private |
| 186 */ | 186 */ |
| 187 enableIsVisible_: function() { | 187 enableIsVisible_: function() { |
| 188 return this.deviceState.Type != CrOnc.Type.ETHERNET && | 188 return this.deviceState.Type != CrOnc.Type.ETHERNET && |
| 189 this.deviceState.Type != CrOnc.Type.VPN; | 189 this.deviceState.Type != CrOnc.Type.VPN; |
| 190 }, | 190 }, |
| 191 | 191 |
| 192 /** | 192 /** |
| 193 * @return {boolean} | |
| 194 * @private | |
| 195 */ | |
| 196 showDetailsIsVisible_: function() { | |
| 197 return this.deviceState.Type == CrOnc.Type.CELLULAR && | |
| 198 this.networkStateList.length == 1; | |
| 199 }, | |
| 200 | |
| 201 /** | |
| 202 * @return {boolean} Whether or not to show the UI to expand the list. | 193 * @return {boolean} Whether or not to show the UI to expand the list. |
| 203 * @private | 194 * @private |
| 204 */ | 195 */ |
| 205 expandIsVisible_: function() { | 196 expandIsVisible_: function() { |
| 206 if (!this.deviceIsEnabled_()) | 197 if (!this.deviceIsEnabled_()) |
| 207 return false; | 198 return false; |
| 208 let type = this.deviceState.Type; | 199 let type = this.deviceState.Type; |
| 209 var minLength = | 200 var minLength = |
| 210 (type == CrOnc.Type.WI_FI || type == CrOnc.Type.VPN) ? 1 : 2; | 201 (type == CrOnc.Type.WI_FI || type == CrOnc.Type.VPN) ? 1 : 2; |
| 211 return this.networkStateList.length >= minLength; | 202 return this.networkStateList.length >= minLength; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 * @private | 256 * @private |
| 266 */ | 257 */ |
| 267 onDeviceEnabledTap_: function(event) { | 258 onDeviceEnabledTap_: function(event) { |
| 268 var deviceIsEnabled = this.deviceIsEnabled_(); | 259 var deviceIsEnabled = this.deviceIsEnabled_(); |
| 269 var type = this.deviceState ? this.deviceState.Type : ''; | 260 var type = this.deviceState ? this.deviceState.Type : ''; |
| 270 this.fire( | 261 this.fire( |
| 271 'device-enabled-toggled', {enabled: !deviceIsEnabled, type: type}); | 262 'device-enabled-toggled', {enabled: !deviceIsEnabled, type: type}); |
| 272 // Make sure this does not propagate to onDetailsTap_. | 263 // Make sure this does not propagate to onDetailsTap_. |
| 273 event.stopPropagation(); | 264 event.stopPropagation(); |
| 274 }, | 265 }, |
| 275 | |
| 276 /** | |
| 277 * @return {string} | |
| 278 * @private | |
| 279 */ | |
| 280 getTabIndex_: function() { | |
| 281 return this.deviceIsEnabled_() ? '0' : '-1'; | |
| 282 }, | |
| 283 }); | 266 }); |
| OLD | NEW |