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 /** @typedef {chrome.networkingPrivate.DeviceStateProperties} */ | 10 /** @typedef {chrome.networkingPrivate.DeviceStateProperties} */ |
(...skipping 11 matching lines...) Expand all Loading... |
22 properties: { | 22 properties: { |
23 /** | 23 /** |
24 * Highest priority connected network or null. Provided by | 24 * Highest priority connected network or null. Provided by |
25 * settings-internet-page (but set in network-summary). | 25 * settings-internet-page (but set in network-summary). |
26 * @type {?CrOnc.NetworkStateProperties|undefined} | 26 * @type {?CrOnc.NetworkStateProperties|undefined} |
27 */ | 27 */ |
28 defaultNetwork: Object, | 28 defaultNetwork: Object, |
29 | 29 |
30 /** | 30 /** |
31 * Device state for the network type. | 31 * Device state for the network type. |
32 * @type {?DeviceStateProperties|undefined} | 32 * @type {?DeviceStateProperties} |
33 */ | 33 */ |
34 deviceState: Object, | 34 deviceState: { |
| 35 type: Object, |
| 36 value: null, |
| 37 }, |
35 | 38 |
36 /** @type {!chrome.networkingPrivate.GlobalPolicy|undefined} */ | 39 /** @type {!chrome.networkingPrivate.GlobalPolicy|undefined} */ |
37 globalPolicy: Object, | 40 globalPolicy: Object, |
38 | 41 |
39 /** | 42 /** |
40 * List of third party VPN providers. | 43 * List of third party VPN providers. |
41 * @type | 44 * @type |
42 * {!Array<!chrome.networkingPrivate.ThirdPartyVPNProperties>|undefined} | 45 * {!Array<!chrome.networkingPrivate.ThirdPartyVPNProperties>|undefined} |
43 */ | 46 */ |
44 thirdPartyVpnProviders: Array, | 47 thirdPartyVpnProviders: Array, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 /** @private */ | 171 /** @private */ |
169 getNetworkStateList_: function() { | 172 getNetworkStateList_: function() { |
170 if (!this.deviceState) | 173 if (!this.deviceState) |
171 return; | 174 return; |
172 var filter = { | 175 var filter = { |
173 networkType: this.deviceState.Type, | 176 networkType: this.deviceState.Type, |
174 visible: true, | 177 visible: true, |
175 configured: false | 178 configured: false |
176 }; | 179 }; |
177 this.networkingPrivate.getNetworks(filter, function(networkStates) { | 180 this.networkingPrivate.getNetworks(filter, function(networkStates) { |
| 181 if (!this.deviceState) |
| 182 return; |
178 if (this.deviceState.Type != CrOnc.Type.VPN) { | 183 if (this.deviceState.Type != CrOnc.Type.VPN) { |
179 this.networkStateList_ = networkStates; | 184 this.networkStateList_ = networkStates; |
180 return; | 185 return; |
181 } | 186 } |
182 // For VPNs, separate out third party VPNs. | 187 // For VPNs, separate out third party VPNs. |
183 var networkStateList = []; | 188 var networkStateList = []; |
184 var thirdPartyVpns = {}; | 189 var thirdPartyVpns = {}; |
185 for (var i = 0; i < networkStates.length; ++i) { | 190 for (var i = 0; i < networkStates.length; ++i) { |
186 var state = networkStates[i]; | 191 var state = networkStates[i]; |
187 var providerType = state.VPN && state.VPN.ThirdPartyVPN && | 192 var providerType = state.VPN && state.VPN.ThirdPartyVPN && |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 showAddButton_: function(deviceState, globalPolicy) { | 292 showAddButton_: function(deviceState, globalPolicy) { |
288 if (!deviceState || deviceState.Type != CrOnc.Type.WI_FI) | 293 if (!deviceState || deviceState.Type != CrOnc.Type.WI_FI) |
289 return false; | 294 return false; |
290 if (!this.deviceIsEnabled_(deviceState)) | 295 if (!this.deviceIsEnabled_(deviceState)) |
291 return false; | 296 return false; |
292 return this.allowAddConnection_(globalPolicy); | 297 return this.allowAddConnection_(globalPolicy); |
293 }, | 298 }, |
294 | 299 |
295 /** @private */ | 300 /** @private */ |
296 onAddButtonTap_: function() { | 301 onAddButtonTap_: function() { |
| 302 assert(this.deviceState); |
297 chrome.send('addNetwork', [this.deviceState.Type]); | 303 chrome.send('addNetwork', [this.deviceState.Type]); |
298 }, | 304 }, |
299 | 305 |
300 /** | 306 /** |
301 * @param {!{model: | 307 * @param {!{model: |
302 * !{item: !chrome.networkingPrivate.ThirdPartyVPNProperties}, | 308 * !{item: !chrome.networkingPrivate.ThirdPartyVPNProperties}, |
303 * }} event | 309 * }} event |
304 * @private | 310 * @private |
305 */ | 311 */ |
306 onAddThirdPartyVpnTap_: function(event) { | 312 onAddThirdPartyVpnTap_: function(event) { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 428 |
423 /** | 429 /** |
424 * @param {*} lhs | 430 * @param {*} lhs |
425 * @param {*} rhs | 431 * @param {*} rhs |
426 * @return {boolean} | 432 * @return {boolean} |
427 */ | 433 */ |
428 isEqual_: function(lhs, rhs) { | 434 isEqual_: function(lhs, rhs) { |
429 return lhs === rhs; | 435 return lhs === rhs; |
430 }, | 436 }, |
431 }); | 437 }); |
OLD | NEW |