| 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 | 6 * @fileoverview |
| 7 * 'settings-internet-detail' is the settings subpage containing details | 7 * 'settings-internet-detail' is the settings subpage containing details |
| 8 * for a network. | 8 * for a network. |
| 9 * | 9 * |
| 10 * @group Chrome Settings Elements | 10 * @group Chrome Settings Elements |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * The network IP Address. | 59 * The network IP Address. |
| 60 */ | 60 */ |
| 61 IPAddress: { | 61 IPAddress: { |
| 62 type: String, | 62 type: String, |
| 63 value: '' | 63 value: '' |
| 64 }, | 64 }, |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * Highest priority connected network or null. |
| 68 * @type {?CrOnc.NetworkStateProperties} |
| 69 */ |
| 70 defaultNetwork: { |
| 71 type: Object, |
| 72 value: null |
| 73 }, |
| 74 |
| 75 /** |
| 67 * Object providing network type values for data binding. | 76 * Object providing network type values for data binding. |
| 68 * @const | 77 * @const |
| 69 */ | 78 */ |
| 70 NetworkType: { | 79 NetworkType: { |
| 71 type: Object, | 80 type: Object, |
| 72 value: { | 81 value: { |
| 73 CELLULAR: CrOnc.Type.CELLULAR, | 82 CELLULAR: CrOnc.Type.CELLULAR, |
| 74 ETHERNET: CrOnc.Type.ETHERNET, | 83 ETHERNET: CrOnc.Type.ETHERNET, |
| 75 VPN: CrOnc.Type.VPN, | 84 VPN: CrOnc.Type.VPN, |
| 76 WIFI: CrOnc.Type.WI_FI, | 85 WIFI: CrOnc.Type.WI_FI, |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 return false; | 310 return false; |
| 302 } | 311 } |
| 303 if (!properties.Cellular.MDN) | 312 if (!properties.Cellular.MDN) |
| 304 return false; | 313 return false; |
| 305 } | 314 } |
| 306 | 315 |
| 307 return true; | 316 return true; |
| 308 }, | 317 }, |
| 309 | 318 |
| 310 /** | 319 /** |
| 320 * @param {!CrOnc.NetworkProperties} properties |
| 321 * @param {?CrOnc.NetworkStateProperties} defaultNetwork |
| 311 * @return {boolean} Whether or not to enable the network connect button. | 322 * @return {boolean} Whether or not to enable the network connect button. |
| 312 * @private | 323 * @private |
| 313 */ | 324 */ |
| 314 enableConnect_: function(properties) { | 325 enableConnect_: function(properties, defaultNetwork) { |
| 315 if (!properties || !this.showConnect_(properties)) | 326 if (!properties || !this.showConnect_(properties)) |
| 316 return false; | 327 return false; |
| 317 if (properties.Type == CrOnc.Type.CELLULAR && CrOnc.isSimLocked(properties)) | 328 if (properties.Type == CrOnc.Type.CELLULAR && CrOnc.isSimLocked(properties)) |
| 318 return false; | 329 return false; |
| 319 // TODO(stevenjb): For VPN, check connected state of any network. | 330 if (properties.Type == CrOnc.Type.VPN && !defaultNetwork) |
| 331 return false; |
| 320 return true; | 332 return true; |
| 321 }, | 333 }, |
| 322 | 334 |
| 323 /** | 335 /** |
| 324 * @param {!CrOnc.NetworkProperties} properties | 336 * @param {!CrOnc.NetworkProperties} properties |
| 325 * @return {boolean} Whether or not to show the 'Disconnect' button. | 337 * @return {boolean} Whether or not to show the 'Disconnect' button. |
| 326 * @private | 338 * @private |
| 327 */ | 339 */ |
| 328 showDisconnect_: function(properties) { | 340 showDisconnect_: function(properties) { |
| 329 return properties.Type != CrOnc.Type.ETHERNET && | 341 return properties.Type != CrOnc.Type.ETHERNET && |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 */ | 682 */ |
| 671 allPropertiesMatch_: function(curValue, newValue) { | 683 allPropertiesMatch_: function(curValue, newValue) { |
| 672 for (let key in newValue) { | 684 for (let key in newValue) { |
| 673 if (newValue[key] != curValue[key]) | 685 if (newValue[key] != curValue[key]) |
| 674 return false; | 686 return false; |
| 675 } | 687 } |
| 676 return true; | 688 return true; |
| 677 } | 689 } |
| 678 }); | 690 }); |
| 679 })(); | 691 })(); |
| OLD | NEW |