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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 */ | 269 */ |
270 updateNetworkStates_: function(networkStates, opt_deviceStates) { | 270 updateNetworkStates_: function(networkStates, opt_deviceStates) { |
271 var newDeviceStates; | 271 var newDeviceStates; |
272 if (opt_deviceStates) { | 272 if (opt_deviceStates) { |
273 newDeviceStates = /** @type {!DeviceStateObject} */ ({}); | 273 newDeviceStates = /** @type {!DeviceStateObject} */ ({}); |
274 for (var i = 0; i < opt_deviceStates.length; ++i) { | 274 for (var i = 0; i < opt_deviceStates.length; ++i) { |
275 var state = opt_deviceStates[i]; | 275 var state = opt_deviceStates[i]; |
276 newDeviceStates[state.Type] = state; | 276 newDeviceStates[state.Type] = state; |
277 } | 277 } |
278 } else { | 278 } else { |
279 newDeviceStates = this.deviceStates; | 279 newDeviceStates = Object.assign({}, this.deviceStates); |
michaelpg
2017/04/17 20:33:27
This is subtle, since the assignment to |this.devi
stevenjb
2017/04/17 20:41:31
I actually have a CL that cleans this up some. It
| |
280 } | 280 } |
281 | 281 |
282 // Clear any current networks. | 282 // Clear any current networks. |
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: [], |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 newActiveNetworkStates.push(state); | 337 newActiveNetworkStates.push(state); |
338 this.activeNetworkIds_.add(state.GUID); | 338 this.activeNetworkIds_.add(state.GUID); |
339 } | 339 } |
340 | 340 |
341 this.deviceStates = newDeviceStates; | 341 this.deviceStates = newDeviceStates; |
342 this.networkStateLists_ = newNetworkStateLists; | 342 this.networkStateLists_ = newNetworkStateLists; |
343 // Set activeNetworkStates last to rebuild the dom-repeat. | 343 // Set activeNetworkStates last to rebuild the dom-repeat. |
344 this.activeNetworkStates_ = newActiveNetworkStates; | 344 this.activeNetworkStates_ = newActiveNetworkStates; |
345 }, | 345 }, |
346 }); | 346 }); |
OLD | NEW |