| 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 a summary of network states | 6 * @fileoverview Polymer element for displaying a summary of network states |
| 7 * by type: Ethernet, WiFi, Cellular, WiMAX, and VPN. | 7 * by type: Ethernet, WiFi, Cellular, WiMAX, and VPN. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 }, | 216 }, |
| 217 | 217 |
| 218 /** | 218 /** |
| 219 * Requests the list of device states and network states from Chrome. | 219 * Requests the list of device states and network states from Chrome. |
| 220 * Updates deviceStates, activeNetworkStates, and networkStateLists once the | 220 * Updates deviceStates, activeNetworkStates, and networkStateLists once the |
| 221 * results are returned from Chrome. | 221 * results are returned from Chrome. |
| 222 * @private | 222 * @private |
| 223 */ | 223 */ |
| 224 getNetworkLists_: function() { | 224 getNetworkLists_: function() { |
| 225 // First get the device states. | 225 // First get the device states. |
| 226 this.networkingPrivate.getDeviceStates(function(deviceStates) { | 226 this.networkingPrivate.getDeviceStates(deviceStates => { |
| 227 // Second get the network states. | 227 // Second get the network states. |
| 228 this.getNetworkStates_(deviceStates); | 228 this.getNetworkStates_(deviceStates); |
| 229 }.bind(this)); | 229 }); |
| 230 }, | 230 }, |
| 231 | 231 |
| 232 /** | 232 /** |
| 233 * Requests the list of network states from Chrome. Updates | 233 * Requests the list of network states from Chrome. Updates |
| 234 * activeNetworkStates and networkStateLists once the results are returned | 234 * activeNetworkStates and networkStateLists once the results are returned |
| 235 * from Chrome. | 235 * from Chrome. |
| 236 * @param {!Array<!CrOnc.DeviceStateProperties>} deviceStates | 236 * @param {!Array<!CrOnc.DeviceStateProperties>} deviceStates |
| 237 * @private | 237 * @private |
| 238 */ | 238 */ |
| 239 getNetworkStates_: function(deviceStates) { | 239 getNetworkStates_: function(deviceStates) { |
| 240 var filter = { | 240 var filter = { |
| 241 networkType: CrOnc.Type.ALL, | 241 networkType: CrOnc.Type.ALL, |
| 242 visible: true, | 242 visible: true, |
| 243 configured: false | 243 configured: false |
| 244 }; | 244 }; |
| 245 this.networkingPrivate.getNetworks(filter, function(networkStates) { | 245 this.networkingPrivate.getNetworks(filter, networkStates => { |
| 246 this.updateNetworkStates_(networkStates, deviceStates); | 246 this.updateNetworkStates_(networkStates, deviceStates); |
| 247 }.bind(this)); | 247 }); |
| 248 }, | 248 }, |
| 249 | 249 |
| 250 /** | 250 /** |
| 251 * Called after network states are received from getNetworks. | 251 * Called after network states are received from getNetworks. |
| 252 * @param {!Array<!CrOnc.NetworkStateProperties>} networkStates The state | 252 * @param {!Array<!CrOnc.NetworkStateProperties>} networkStates The state |
| 253 * properties for all visible networks. | 253 * properties for all visible networks. |
| 254 * @param {!Array<!CrOnc.DeviceStateProperties>} deviceStates | 254 * @param {!Array<!CrOnc.DeviceStateProperties>} deviceStates |
| 255 * @private | 255 * @private |
| 256 */ | 256 */ |
| 257 updateNetworkStates_: function(networkStates, deviceStates) { | 257 updateNetworkStates_: function(networkStates, deviceStates) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 * @param {string} type | 348 * @param {string} type |
| 349 * @return {!CrOnc.NetworkStateProperties|undefined} | 349 * @return {!CrOnc.NetworkStateProperties|undefined} |
| 350 */ | 350 */ |
| 351 getActiveStateForType_: function(activeStatesByType, type) { | 351 getActiveStateForType_: function(activeStatesByType, type) { |
| 352 var activeState = activeStatesByType.get(type); | 352 var activeState = activeStatesByType.get(type); |
| 353 if (!activeState && type == CrOnc.Type.CELLULAR) | 353 if (!activeState && type == CrOnc.Type.CELLULAR) |
| 354 activeState = activeStatesByType.get(CrOnc.Type.TETHER); | 354 activeState = activeStatesByType.get(CrOnc.Type.TETHER); |
| 355 return activeState || {GUID: '', Type: type}; | 355 return activeState || {GUID: '', Type: type}; |
| 356 }, | 356 }, |
| 357 }); | 357 }); |
| OLD | NEW |