| 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 /** @typedef {chrome.networkingPrivate.DeviceStateProperties} */ | 10 /** @typedef {chrome.networkingPrivate.DeviceStateProperties} */ |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 var activeNetworkStatesByType = | 283 var activeNetworkStatesByType = |
| 284 /** @type {!Map<string, !CrOnc.NetworkStateProperties>} */ (new Map); | 284 /** @type {!Map<string, !CrOnc.NetworkStateProperties>} */ (new Map); |
| 285 | 285 |
| 286 // Complete list of states by type. | 286 // Complete list of states by type. |
| 287 /** @type {!NetworkStateListObject} */ var newNetworkStateLists = { | 287 /** @type {!NetworkStateListObject} */ var newNetworkStateLists = { |
| 288 Ethernet: [], | 288 Ethernet: [], |
| 289 WiFi: [], | 289 WiFi: [], |
| 290 Cellular: [], | 290 Cellular: [], |
| 291 WiMAX: [], | 291 WiMAX: [], |
| 292 VPN: [], | 292 VPN: [], |
| 293 Tether: [], |
| 293 }; | 294 }; |
| 294 | 295 |
| 295 var firstConnectedNetwork = null; | 296 var firstConnectedNetwork = null; |
| 296 networkStates.forEach(function(networkState) { | 297 networkStates.forEach(function(networkState) { |
| 297 var type = networkState.Type; | 298 var type = networkState.Type; |
| 298 if (!activeNetworkStatesByType.has(type)) { | 299 if (!activeNetworkStatesByType.has(type)) { |
| 299 activeNetworkStatesByType.set(type, networkState); | 300 activeNetworkStatesByType.set(type, networkState); |
| 300 if (!firstConnectedNetwork && networkState.Type != CrOnc.Type.VPN && | 301 if (!firstConnectedNetwork && networkState.Type != CrOnc.Type.VPN && |
| 301 networkState.ConnectionState == CrOnc.ConnectionState.CONNECTED) { | 302 networkState.ConnectionState == CrOnc.ConnectionState.CONNECTED) { |
| 302 firstConnectedNetwork = networkState; | 303 firstConnectedNetwork = networkState; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 newActiveNetworkStates.push(state); | 338 newActiveNetworkStates.push(state); |
| 338 this.activeNetworkIds_.add(state.GUID); | 339 this.activeNetworkIds_.add(state.GUID); |
| 339 } | 340 } |
| 340 | 341 |
| 341 this.deviceStates = newDeviceStates; | 342 this.deviceStates = newDeviceStates; |
| 342 this.networkStateLists_ = newNetworkStateLists; | 343 this.networkStateLists_ = newNetworkStateLists; |
| 343 // Set activeNetworkStates last to rebuild the dom-repeat. | 344 // Set activeNetworkStates last to rebuild the dom-repeat. |
| 344 this.activeNetworkStates_ = newActiveNetworkStates; | 345 this.activeNetworkStates_ = newActiveNetworkStates; |
| 345 }, | 346 }, |
| 346 }); | 347 }); |
| OLD | NEW |