| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * The network IP Address. | 61 * The network IP Address. |
| 62 */ | 62 */ |
| 63 IPAddress: { | 63 IPAddress: { |
| 64 type: String, | 64 type: String, |
| 65 value: '' | 65 value: '' |
| 66 }, | 66 }, |
| 67 | 67 |
| 68 /** | 68 /** |
| 69 * Highest priority connected network or null. |
| 70 * @type {?CrOnc.NetworkStateProperties} |
| 71 */ |
| 72 defaultNetwork: { |
| 73 type: Object, |
| 74 value: null |
| 75 }, |
| 76 |
| 77 /** |
| 69 * Object providing network type values for data binding. | 78 * Object providing network type values for data binding. |
| 70 * @const | 79 * @const |
| 71 */ | 80 */ |
| 72 NetworkType: { | 81 NetworkType: { |
| 73 type: Object, | 82 type: Object, |
| 74 value: { | 83 value: { |
| 75 CELLULAR: CrOnc.Type.CELLULAR, | 84 CELLULAR: CrOnc.Type.CELLULAR, |
| 76 ETHERNET: CrOnc.Type.ETHERNET, | 85 ETHERNET: CrOnc.Type.ETHERNET, |
| 77 VPN: CrOnc.Type.VPN, | 86 VPN: CrOnc.Type.VPN, |
| 78 WIFI: CrOnc.Type.WI_FI, | 87 WIFI: CrOnc.Type.WI_FI, |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 return false; | 312 return false; |
| 304 } | 313 } |
| 305 if (!properties.Cellular.MDN) | 314 if (!properties.Cellular.MDN) |
| 306 return false; | 315 return false; |
| 307 } | 316 } |
| 308 | 317 |
| 309 return true; | 318 return true; |
| 310 }, | 319 }, |
| 311 | 320 |
| 312 /** | 321 /** |
| 322 * @param {!CrOnc.NetworkProperties} properties |
| 323 * @param {?CrOnc.NetworkStateProperties} defaultNetwork |
| 313 * @return {boolean} Whether or not to enable the network connect button. | 324 * @return {boolean} Whether or not to enable the network connect button. |
| 314 * @private | 325 * @private |
| 315 */ | 326 */ |
| 316 enableConnect_: function(properties) { | 327 enableConnect_: function(properties, defaultNetwork) { |
| 317 if (!properties || !this.showConnect_(properties)) | 328 if (!properties || !this.showConnect_(properties)) |
| 318 return false; | 329 return false; |
| 319 if (properties.Type == CrOnc.Type.CELLULAR && CrOnc.isSimLocked(properties)) | 330 if (properties.Type == CrOnc.Type.CELLULAR && CrOnc.isSimLocked(properties)) |
| 320 return false; | 331 return false; |
| 321 // TODO(stevenjb): For VPN, check connected state of any network. | 332 if (properties.Type == CrOnc.Type.VPN && !defaultNetwork) |
| 333 return false; |
| 322 return true; | 334 return true; |
| 323 }, | 335 }, |
| 324 | 336 |
| 325 /** | 337 /** |
| 326 * @param {!CrOnc.NetworkProperties} properties | 338 * @param {!CrOnc.NetworkProperties} properties |
| 327 * @return {boolean} Whether or not to show the 'Disconnect' button. | 339 * @return {boolean} Whether or not to show the 'Disconnect' button. |
| 328 * @private | 340 * @private |
| 329 */ | 341 */ |
| 330 showDisconnect_: function(properties) { | 342 showDisconnect_: function(properties) { |
| 331 return properties.Type != CrOnc.Type.ETHERNET && | 343 return properties.Type != CrOnc.Type.ETHERNET && |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 */ | 693 */ |
| 682 allPropertiesMatch_: function(curValue, newValue) { | 694 allPropertiesMatch_: function(curValue, newValue) { |
| 683 for (let key in newValue) { | 695 for (let key in newValue) { |
| 684 if (newValue[key] != curValue[key]) | 696 if (newValue[key] != curValue[key]) |
| 685 return false; | 697 return false; |
| 686 } | 698 } |
| 687 return true; | 699 return true; |
| 688 } | 700 } |
| 689 }); | 701 }); |
| 690 })(); | 702 })(); |
| OLD | NEW |