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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 if (!deviceState || deviceState.Type != CrOnc.Type.WI_FI) | 295 if (!deviceState || deviceState.Type != CrOnc.Type.WI_FI) |
296 return false; | 296 return false; |
297 if (!this.deviceIsEnabled_(deviceState)) | 297 if (!this.deviceIsEnabled_(deviceState)) |
298 return false; | 298 return false; |
299 return this.allowAddConnection_(globalPolicy); | 299 return this.allowAddConnection_(globalPolicy); |
300 }, | 300 }, |
301 | 301 |
302 /** @private */ | 302 /** @private */ |
303 onAddButtonTap_: function() { | 303 onAddButtonTap_: function() { |
304 assert(this.deviceState); | 304 assert(this.deviceState); |
305 chrome.send('addNetwork', [this.deviceState.Type]); | 305 if (loadTimeData.getBoolean('networkSettingsConfig')) |
| 306 this.fire('show-config', {Type: this.deviceState.Type}); |
| 307 else |
| 308 chrome.send('addNetwork', [this.deviceState.Type]); |
306 }, | 309 }, |
307 | 310 |
308 /** | 311 /** |
309 * @param {!{model: | 312 * @param {!{model: |
310 * !{item: !chrome.networkingPrivate.ThirdPartyVPNProperties}, | 313 * !{item: !chrome.networkingPrivate.ThirdPartyVPNProperties}, |
311 * }} event | 314 * }} event |
312 * @private | 315 * @private |
313 */ | 316 */ |
314 onAddThirdPartyVpnTap_: function(event) { | 317 onAddThirdPartyVpnTap_: function(event) { |
315 var provider = event.model.item; | 318 var provider = event.model.item; |
316 chrome.send('addNetwork', [CrOnc.Type.VPN, provider.ExtensionID]); | 319 chrome.send('addNetwork', [CrOnc.Type.VPN, provider.ExtensionID]); |
317 }, | 320 }, |
318 | 321 |
319 /** | 322 /** |
320 * @param {!DeviceStateProperties} deviceState | 323 * @param {!DeviceStateProperties} deviceState |
321 * @return {boolean} | 324 * @return {boolean} |
322 * @private | 325 * @private |
323 */ | 326 */ |
324 knownNetworksIsVisible_: function(deviceState) { | 327 knownNetworksIsVisible_: function(deviceState) { |
325 return deviceState && deviceState.Type == CrOnc.Type.WI_FI; | 328 return deviceState && deviceState.Type == CrOnc.Type.WI_FI; |
326 }, | 329 }, |
327 | 330 |
328 /** | 331 /** |
329 * Event triggered when the known networks button is tapped. | 332 * Event triggered when the known networks button is tapped. |
330 * @private | 333 * @private |
331 */ | 334 */ |
332 onKnownNetworksTap_: function() { | 335 onKnownNetworksTap_: function() { |
333 this.fire('show-known-networks', {Type: CrOnc.Type.WI_FI}); | 336 assert(this.deviceState.Type == CrOnc.Type.WI_FI); |
| 337 this.fire('show-known-networks', {Type: this.deviceState.Type}); |
334 }, | 338 }, |
335 | 339 |
336 /** | 340 /** |
337 * Event triggered when the enable button is toggled. | 341 * Event triggered when the enable button is toggled. |
338 * @param {!Event} event | 342 * @param {!Event} event |
339 * @private | 343 * @private |
340 */ | 344 */ |
341 onDeviceEnabledTap_: function(event) { | 345 onDeviceEnabledTap_: function(event) { |
342 assert(this.deviceState); | 346 assert(this.deviceState); |
343 this.fire('device-enabled-toggled', { | 347 this.fire('device-enabled-toggled', { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 415 |
412 /** | 416 /** |
413 * @param {*} lhs | 417 * @param {*} lhs |
414 * @param {*} rhs | 418 * @param {*} rhs |
415 * @return {boolean} | 419 * @return {boolean} |
416 */ | 420 */ |
417 isEqual_: function(lhs, rhs) { | 421 isEqual_: function(lhs, rhs) { |
418 return lhs === rhs; | 422 return lhs === rhs; |
419 }, | 423 }, |
420 }); | 424 }); |
OLD | NEW |