| 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 (function() { | 10 (function() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 /** | 25 /** |
| 26 * The current properties for the network matching |guid|. | 26 * The current properties for the network matching |guid|. |
| 27 * @type {!CrOnc.NetworkProperties|undefined} | 27 * @type {!CrOnc.NetworkProperties|undefined} |
| 28 */ | 28 */ |
| 29 networkProperties: { | 29 networkProperties: { |
| 30 type: Object, | 30 type: Object, |
| 31 observer: 'networkPropertiesChanged_', | 31 observer: 'networkPropertiesChanged_', |
| 32 }, | 32 }, |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * Highest priority connected network or null. |
| 36 * @type {?CrOnc.NetworkStateProperties} |
| 37 */ |
| 38 defaultNetwork: { |
| 39 type: Object, |
| 40 value: null, |
| 41 }, |
| 42 |
| 43 /** |
| 44 * Interface for networkingPrivate calls, passed from internet_page. |
| 45 * @type {NetworkingPrivate} |
| 46 */ |
| 47 networkingPrivate: Object, |
| 48 |
| 49 /** |
| 35 * The network AutoConnect state. | 50 * The network AutoConnect state. |
| 51 * @private |
| 36 */ | 52 */ |
| 37 autoConnect: { | 53 autoConnect_: { |
| 38 type: Boolean, | 54 type: Boolean, |
| 39 value: false, | 55 value: false, |
| 40 observer: 'autoConnectChanged_', | 56 observer: 'autoConnectChanged_', |
| 41 }, | 57 }, |
| 42 | 58 |
| 43 /** | 59 /** |
| 44 * The network preferred state. | 60 * The network preferred state. |
| 61 * @private |
| 45 */ | 62 */ |
| 46 preferNetwork: { | 63 preferNetwork_: { |
| 47 type: Boolean, | 64 type: Boolean, |
| 48 value: false, | 65 value: false, |
| 49 observer: 'preferNetworkChanged_', | 66 observer: 'preferNetworkChanged_', |
| 50 }, | 67 }, |
| 51 | 68 |
| 52 /** | 69 /** |
| 53 * The network IP Address. | 70 * The network IP Address. |
| 71 * @private |
| 54 */ | 72 */ |
| 55 IPAddress: { | 73 IPAddress_: { |
| 56 type: String, | 74 type: String, |
| 57 value: '', | 75 value: '', |
| 58 }, | 76 }, |
| 59 | 77 |
| 60 /** | 78 /** @private */ |
| 61 * Highest priority connected network or null. | 79 advancedExpanded_: Boolean, |
| 62 * @type {?CrOnc.NetworkStateProperties} | |
| 63 */ | |
| 64 defaultNetwork: { | |
| 65 type: Object, | |
| 66 value: null, | |
| 67 }, | |
| 68 | |
| 69 advancedExpanded: {type: Boolean}, | |
| 70 | 80 |
| 71 /** | 81 /** |
| 72 * Object providing network type values for data binding. | 82 * Object providing network type values for data binding. |
| 73 * @const | 83 * @const |
| 84 * @private |
| 74 */ | 85 */ |
| 75 NetworkType: { | 86 NetworkType_: { |
| 76 type: Object, | 87 type: Object, |
| 77 value: { | 88 value: { |
| 78 CELLULAR: CrOnc.Type.CELLULAR, | 89 CELLULAR: CrOnc.Type.CELLULAR, |
| 79 ETHERNET: CrOnc.Type.ETHERNET, | 90 ETHERNET: CrOnc.Type.ETHERNET, |
| 80 VPN: CrOnc.Type.VPN, | 91 VPN: CrOnc.Type.VPN, |
| 81 WIFI: CrOnc.Type.WI_FI, | 92 WIFI: CrOnc.Type.WI_FI, |
| 82 WIMAX: CrOnc.Type.WI_MAX, | 93 WIMAX: CrOnc.Type.WI_MAX, |
| 83 }, | 94 }, |
| 84 readOnly: true | 95 readOnly: true |
| 85 }, | 96 }, |
| 86 | |
| 87 /** | |
| 88 * Interface for networkingPrivate calls, passed from internet_page. | |
| 89 * @type {NetworkingPrivate} | |
| 90 */ | |
| 91 networkingPrivate: {type: Object}, | |
| 92 }, | 97 }, |
| 93 | 98 |
| 94 /** | 99 /** |
| 95 * Listener function for chrome.networkingPrivate.onNetworksChanged event. | 100 * Listener function for chrome.networkingPrivate.onNetworksChanged event. |
| 96 * @type {?function(!Array<string>)} | 101 * @type {?function(!Array<string>)} |
| 97 * @private | 102 * @private |
| 98 */ | 103 */ |
| 99 networksChangedListener_: null, | 104 networksChangedListener_: null, |
| 100 | 105 |
| 101 /** | 106 /** |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 }); | 140 }); |
| 136 }, | 141 }, |
| 137 | 142 |
| 138 /** @private */ | 143 /** @private */ |
| 139 networkPropertiesChanged_: function() { | 144 networkPropertiesChanged_: function() { |
| 140 if (!this.networkProperties) | 145 if (!this.networkProperties) |
| 141 return; | 146 return; |
| 142 | 147 |
| 143 // Update autoConnect if it has changed. Default value is false. | 148 // Update autoConnect if it has changed. Default value is false. |
| 144 var autoConnect = CrOnc.getAutoConnect(this.networkProperties); | 149 var autoConnect = CrOnc.getAutoConnect(this.networkProperties); |
| 145 if (autoConnect != this.autoConnect) | 150 if (autoConnect != this.autoConnect_) |
| 146 this.autoConnect = autoConnect; | 151 this.autoConnect_ = autoConnect; |
| 147 | 152 |
| 148 // Update preferNetwork if it has changed. Default value is false. | 153 // Update preferNetwork if it has changed. Default value is false. |
| 149 var priority = /** @type {number} */ ( | 154 var priority = /** @type {number} */ ( |
| 150 CrOnc.getActiveValue(this.networkProperties.Priority) || 0); | 155 CrOnc.getActiveValue(this.networkProperties.Priority) || 0); |
| 151 var preferNetwork = priority > 0; | 156 var preferNetwork = priority > 0; |
| 152 if (preferNetwork != this.preferNetwork) | 157 if (preferNetwork != this.preferNetwork_) |
| 153 this.preferNetwork = preferNetwork; | 158 this.preferNetwork_ = preferNetwork; |
| 154 | 159 |
| 155 // Set the IPAddress property to the IPV4 Address. | 160 // Set the IPAddress property to the IPV4 Address. |
| 156 var ipv4 = | 161 var ipv4 = |
| 157 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); | 162 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); |
| 158 this.IPAddress = (ipv4 && ipv4.IPAddress) || ''; | 163 this.IPAddress_ = (ipv4 && ipv4.IPAddress) || ''; |
| 159 }, | 164 }, |
| 160 | 165 |
| 161 /** @private */ | 166 /** @private */ |
| 162 autoConnectChanged_: function() { | 167 autoConnectChanged_: function() { |
| 163 if (!this.networkProperties || !this.guid) | 168 if (!this.networkProperties || !this.guid) |
| 164 return; | 169 return; |
| 165 var onc = this.getEmptyNetworkProperties_(); | 170 var onc = this.getEmptyNetworkProperties_(); |
| 166 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect); | 171 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect_); |
| 167 this.setNetworkProperties_(onc); | 172 this.setNetworkProperties_(onc); |
| 168 }, | 173 }, |
| 169 | 174 |
| 170 /** @private */ | 175 /** @private */ |
| 171 preferNetworkChanged_: function() { | 176 preferNetworkChanged_: function() { |
| 172 if (!this.networkProperties || !this.guid) | 177 if (!this.networkProperties || !this.guid) |
| 173 return; | 178 return; |
| 174 var onc = this.getEmptyNetworkProperties_(); | 179 var onc = this.getEmptyNetworkProperties_(); |
| 175 onc.Priority = this.preferNetwork ? 1 : 0; | 180 onc.Priority = this.preferNetwork_ ? 1 : 0; |
| 176 this.setNetworkProperties_(onc); | 181 this.setNetworkProperties_(onc); |
| 177 }, | 182 }, |
| 178 | 183 |
| 179 /** | 184 /** |
| 180 * networkingPrivate.onNetworksChanged event callback. | 185 * networkingPrivate.onNetworksChanged event callback. |
| 181 * @param {!Array<string>} networkIds The list of changed network GUIDs. | 186 * @param {!Array<string>} networkIds The list of changed network GUIDs. |
| 182 * @private | 187 * @private |
| 183 */ | 188 */ |
| 184 onNetworksChangedEvent_: function(networkIds) { | 189 onNetworksChangedEvent_: function(networkIds) { |
| 185 if (networkIds.indexOf(this.guid) != -1) | 190 if (networkIds.indexOf(this.guid) != -1) |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 this.networkingPrivate.startActivate(this.guid); | 427 this.networkingPrivate.startActivate(this.guid); |
| 423 }, | 428 }, |
| 424 | 429 |
| 425 /** | 430 /** |
| 426 * @param {Event} event | 431 * @param {Event} event |
| 427 * @private | 432 * @private |
| 428 */ | 433 */ |
| 429 toggleAdvancedExpanded_: function(event) { | 434 toggleAdvancedExpanded_: function(event) { |
| 430 if (event.target.id == 'expandButton') | 435 if (event.target.id == 'expandButton') |
| 431 return; // Already handled. | 436 return; // Already handled. |
| 432 this.advancedExpanded = !this.advancedExpanded; | 437 this.advancedExpanded_ = !this.advancedExpanded_; |
| 433 }, | 438 }, |
| 434 | 439 |
| 435 /** | 440 /** |
| 436 * Event triggered for elements associated with network properties. | 441 * Event triggered for elements associated with network properties. |
| 437 * @param {!{detail: !{field: string, value: (string|!Object)}}} event | 442 * @param {!{detail: !{field: string, value: (string|!Object)}}} event |
| 438 * @private | 443 * @private |
| 439 */ | 444 */ |
| 440 onNetworkPropertyChange_: function(event) { | 445 onNetworkPropertyChange_: function(event) { |
| 441 if (!this.networkProperties) | 446 if (!this.networkProperties) |
| 442 return; | 447 return; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 */ | 747 */ |
| 743 allPropertiesMatch_: function(curValue, newValue) { | 748 allPropertiesMatch_: function(curValue, newValue) { |
| 744 for (let key in newValue) { | 749 for (let key in newValue) { |
| 745 if (newValue[key] != curValue[key]) | 750 if (newValue[key] != curValue[key]) |
| 746 return false; | 751 return false; |
| 747 } | 752 } |
| 748 return true; | 753 return true; |
| 749 } | 754 } |
| 750 }); | 755 }); |
| 751 })(); | 756 })(); |
| OLD | NEW |