| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 information about WiFi, | 6 * @fileoverview Polymer element for displaying information about WiFi, |
| 7 * WiMAX, or virtual networks. | 7 * WiMAX, or virtual networks. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 Polymer({ | 10 Polymer({ |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 this.showSpinner = !!this.deviceState.Scanning; | 143 this.showSpinner = !!this.deviceState.Scanning; |
| 144 this.startScanning_(); | 144 this.startScanning_(); |
| 145 }, | 145 }, |
| 146 | 146 |
| 147 /** @private */ | 147 /** @private */ |
| 148 startScanning_: function() { | 148 startScanning_: function() { |
| 149 if (this.scanIntervalId_ != null) | 149 if (this.scanIntervalId_ != null) |
| 150 return; | 150 return; |
| 151 /** @const */ var INTERVAL_MS = 10 * 1000; | 151 /** @const */ var INTERVAL_MS = 10 * 1000; |
| 152 this.networkingPrivate.requestNetworkScan(); | 152 this.networkingPrivate.requestNetworkScan(); |
| 153 this.scanIntervalId_ = window.setInterval(function() { | 153 this.scanIntervalId_ = window.setInterval(() => { |
| 154 this.networkingPrivate.requestNetworkScan(); | 154 this.networkingPrivate.requestNetworkScan(); |
| 155 }.bind(this), INTERVAL_MS); | 155 }, INTERVAL_MS); |
| 156 }, | 156 }, |
| 157 | 157 |
| 158 /** @private */ | 158 /** @private */ |
| 159 stopScanning_: function() { | 159 stopScanning_: function() { |
| 160 if (this.scanIntervalId_ == null) | 160 if (this.scanIntervalId_ == null) |
| 161 return; | 161 return; |
| 162 window.clearInterval(this.scanIntervalId_); | 162 window.clearInterval(this.scanIntervalId_); |
| 163 this.scanIntervalId_ = null; | 163 this.scanIntervalId_ = null; |
| 164 }, | 164 }, |
| 165 | 165 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 192 return; // Edge case when device states change before this callback. | 192 return; // Edge case when device states change before this callback. |
| 193 | 193 |
| 194 // For the Cellular/Mobile subpage, request Tether networks if available. | 194 // For the Cellular/Mobile subpage, request Tether networks if available. |
| 195 if (this.deviceState.Type == CrOnc.Type.CELLULAR && | 195 if (this.deviceState.Type == CrOnc.Type.CELLULAR && |
| 196 this.tetherDeviceState) { | 196 this.tetherDeviceState) { |
| 197 var filter = { | 197 var filter = { |
| 198 networkType: CrOnc.Type.TETHER, | 198 networkType: CrOnc.Type.TETHER, |
| 199 visible: true, | 199 visible: true, |
| 200 configured: false | 200 configured: false |
| 201 }; | 201 }; |
| 202 this.networkingPrivate.getNetworks(filter, function(tetherNetworkStates) { | 202 this.networkingPrivate.getNetworks(filter, tetherNetworkStates => { |
| 203 this.networkStateList_ = networkStates.concat(tetherNetworkStates); | 203 this.networkStateList_ = networkStates.concat(tetherNetworkStates); |
| 204 }.bind(this)); | 204 }); |
| 205 return; | 205 return; |
| 206 } | 206 } |
| 207 | 207 |
| 208 // For VPNs, separate out third party VPNs. | 208 // For VPNs, separate out third party VPNs. |
| 209 if (this.deviceState.Type == CrOnc.Type.VPN) { | 209 if (this.deviceState.Type == CrOnc.Type.VPN) { |
| 210 var builtinNetworkStates = []; | 210 var builtinNetworkStates = []; |
| 211 var thirdPartyVpns = {}; | 211 var thirdPartyVpns = {}; |
| 212 for (var i = 0; i < networkStates.length; ++i) { | 212 for (var i = 0; i < networkStates.length; ++i) { |
| 213 var state = networkStates[i]; | 213 var state = networkStates[i]; |
| 214 var providerType = state.VPN && state.VPN.ThirdPartyVPN && | 214 var providerType = state.VPN && state.VPN.ThirdPartyVPN && |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 * @return {boolean} | 483 * @return {boolean} |
| 484 * @private | 484 * @private |
| 485 */ | 485 */ |
| 486 shouldShowNetworkList_: function(networkStateList) { | 486 shouldShowNetworkList_: function(networkStateList) { |
| 487 return networkStateList.length > 0; | 487 return networkStateList.length > 0; |
| 488 }, | 488 }, |
| 489 | 489 |
| 490 /** | 490 /** |
| 491 * @param {!CrOnc.DeviceStateProperties|undefined} deviceState | 491 * @param {!CrOnc.DeviceStateProperties|undefined} deviceState |
| 492 * @param {!CrOnc.DeviceStateProperties|undefined} tetherDeviceState | 492 * @param {!CrOnc.DeviceStateProperties|undefined} tetherDeviceState |
| 493 * @return {boolean} | 493 * @return {string} |
| 494 * @private | 494 * @private |
| 495 */ | 495 */ |
| 496 getNoNetworksString_: function(deviceState, tetherDeviceState) { | 496 getNoNetworksString_: function(deviceState, tetherDeviceState) { |
| 497 var type = deviceState.Type; | 497 var type = deviceState.Type; |
| 498 if (type == CrOnc.Type.TETHER || | 498 if (type == CrOnc.Type.TETHER || |
| 499 (type == CrOnc.Type.CELLULAR && this.tetherDeviceState)) { | 499 (type == CrOnc.Type.CELLULAR && this.tetherDeviceState)) { |
| 500 return this.i18nAdvanced('internetNoNetworksMobileData'); | 500 return this.i18nAdvanced('internetNoNetworksMobileData'); |
| 501 } | 501 } |
| 502 | 502 |
| 503 return this.i18n('internetNoNetworks'); | 503 return this.i18n('internetNoNetworks'); |
| 504 }, | 504 }, |
| 505 }); | 505 }); |
| OLD | NEW |