| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 }, | 111 }, |
| 112 | 112 |
| 113 /** @private */ | 113 /** @private */ |
| 114 advancedExpanded_: Boolean, | 114 advancedExpanded_: Boolean, |
| 115 | 115 |
| 116 /** @private */ | 116 /** @private */ |
| 117 networkExpanded_: Boolean, | 117 networkExpanded_: Boolean, |
| 118 | 118 |
| 119 /** @private */ | 119 /** @private */ |
| 120 proxyExpanded_: Boolean, | 120 proxyExpanded_: Boolean, |
| 121 | |
| 122 /** | |
| 123 * Object providing network type values for data binding. | |
| 124 * @const | |
| 125 * @private | |
| 126 */ | |
| 127 NetworkType_: { | |
| 128 type: Object, | |
| 129 value: { | |
| 130 CELLULAR: CrOnc.Type.CELLULAR, | |
| 131 ETHERNET: CrOnc.Type.ETHERNET, | |
| 132 TETHER: CrOnc.Type.TETHER, | |
| 133 VPN: CrOnc.Type.VPN, | |
| 134 WIFI: CrOnc.Type.WI_FI, | |
| 135 WIMAX: CrOnc.Type.WI_MAX, | |
| 136 }, | |
| 137 readOnly: true | |
| 138 }, | |
| 139 }, | 121 }, |
| 140 | 122 |
| 141 /** | 123 /** |
| 142 * Listener function for chrome.networkingPrivate.onNetworksChanged event. | 124 * Listener function for chrome.networkingPrivate.onNetworksChanged event. |
| 143 * @type {?function(!Array<string>)} | 125 * @type {?function(!Array<string>)} |
| 144 * @private | 126 * @private |
| 145 */ | 127 */ |
| 146 networksChangedListener_: null, | 128 networksChangedListener_: null, |
| 147 | 129 |
| 148 /** @private {boolean} */ | 130 /** @private {boolean} */ |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 Type: type, | 192 Type: type, |
| 211 ConnectionState: CrOnc.ConnectionState.NOT_CONNECTED, | 193 ConnectionState: CrOnc.ConnectionState.NOT_CONNECTED, |
| 212 Name: {Active: name}, | 194 Name: {Active: name}, |
| 213 }; | 195 }; |
| 214 this.didSetFocus_ = false; | 196 this.didSetFocus_ = false; |
| 215 this.getNetworkDetails_(); | 197 this.getNetworkDetails_(); |
| 216 }, | 198 }, |
| 217 | 199 |
| 218 /** @private */ | 200 /** @private */ |
| 219 close_: function() { | 201 close_: function() { |
| 220 // Delay navigating until the next render frame to allow other subpages to | 202 // Delay navigating to allow other subpages to load first. |
| 221 // load first. | 203 requestAnimationFrame(function() { |
| 222 setTimeout(function() { | 204 settings.navigateToPreviousRoute(); |
| 223 settings.navigateTo(settings.Route.INTERNET); | |
| 224 }); | 205 }); |
| 225 }, | 206 }, |
| 226 | 207 |
| 227 /** @private */ | 208 /** @private */ |
| 228 networkPropertiesChanged_: function() { | 209 networkPropertiesChanged_: function() { |
| 229 if (!this.networkProperties) | 210 if (!this.networkProperties) |
| 230 return; | 211 return; |
| 231 | 212 |
| 232 // Update autoConnect if it has changed. Default value is false. | 213 // Update autoConnect if it has changed. Default value is false. |
| 233 var autoConnect = CrOnc.getAutoConnect(this.networkProperties); | 214 var autoConnect = CrOnc.getAutoConnect(this.networkProperties); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 this.networkingPrivate.getState( | 286 this.networkingPrivate.getState( |
| 306 this.guid, this.getStateCallback_.bind(this)); | 287 this.guid, this.getStateCallback_.bind(this)); |
| 307 } else { | 288 } else { |
| 308 this.networkingPrivate.getManagedProperties( | 289 this.networkingPrivate.getManagedProperties( |
| 309 this.guid, this.getPropertiesCallback_.bind(this)); | 290 this.guid, this.getPropertiesCallback_.bind(this)); |
| 310 } | 291 } |
| 311 }, | 292 }, |
| 312 | 293 |
| 313 /** | 294 /** |
| 314 * networkingPrivate.getProperties callback. | 295 * networkingPrivate.getProperties callback. |
| 315 * @param {CrOnc.NetworkProperties} properties The network properties. | 296 * @param {!CrOnc.NetworkProperties} properties The network properties. |
| 316 * @private | 297 * @private |
| 317 */ | 298 */ |
| 318 getPropertiesCallback_: function(properties) { | 299 getPropertiesCallback_: function(properties) { |
| 319 if (chrome.runtime.lastError) { | 300 if (chrome.runtime.lastError) { |
| 320 var message = chrome.runtime.lastError.message; | 301 var message = chrome.runtime.lastError.message; |
| 321 if (message == 'Error.InvalidNetworkGuid') { | 302 if (message == 'Error.InvalidNetworkGuid') { |
| 322 console.error('Details page: GUID no longer exists: ' + this.guid); | 303 console.error('Details page: GUID no longer exists: ' + this.guid); |
| 323 } else { | 304 } else { |
| 324 console.error( | 305 console.error( |
| 325 'Unexpected networkingPrivate.getManagedProperties error: ' + | 306 'Unexpected networkingPrivate.getManagedProperties error: ' + |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 */ | 959 */ |
| 979 hasNetworkSection_: function(networkProperties) { | 960 hasNetworkSection_: function(networkProperties) { |
| 980 if (networkProperties.Type == CrOnc.Type.VPN) | 961 if (networkProperties.Type == CrOnc.Type.VPN) |
| 981 return false; | 962 return false; |
| 982 if (networkProperties.Type == CrOnc.Type.CELLULAR) | 963 if (networkProperties.Type == CrOnc.Type.CELLULAR) |
| 983 return true; | 964 return true; |
| 984 return this.isRememberedOrConnected_(networkProperties); | 965 return this.isRememberedOrConnected_(networkProperties); |
| 985 }, | 966 }, |
| 986 | 967 |
| 987 /** | 968 /** |
| 988 * @param {string} type The network type. | |
| 989 * @param {!CrOnc.NetworkProperties} networkProperties | |
| 990 * @return {boolean} True if the network type matches 'type'. | |
| 991 * @private | |
| 992 */ | |
| 993 isType_: function(type, networkProperties) { | |
| 994 return networkProperties.Type == type; | |
| 995 }, | |
| 996 | |
| 997 /** | |
| 998 * @param {!CrOnc.NetworkProperties} networkProperties | 969 * @param {!CrOnc.NetworkProperties} networkProperties |
| 999 * @return {boolean} | 970 * @return {boolean} |
| 1000 * @private | 971 * @private |
| 1001 */ | 972 */ |
| 1002 showCellularSim_: function(networkProperties) { | 973 showCellularSim_: function(networkProperties) { |
| 1003 if (networkProperties.Type != 'Cellular' || | 974 if (networkProperties.Type != 'Cellular' || |
| 1004 !networkProperties.Cellular) { | 975 !networkProperties.Cellular) { |
| 1005 return false; | 976 return false; |
| 1006 } | 977 } |
| 1007 return networkProperties.Cellular.Family == 'GSM'; | 978 return networkProperties.Cellular.Family == 'GSM'; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1018 */ | 989 */ |
| 1019 allPropertiesMatch_: function(curValue, newValue) { | 990 allPropertiesMatch_: function(curValue, newValue) { |
| 1020 for (var key in newValue) { | 991 for (var key in newValue) { |
| 1021 if (newValue[key] != curValue[key]) | 992 if (newValue[key] != curValue[key]) |
| 1022 return false; | 993 return false; |
| 1023 } | 994 } |
| 1024 return true; | 995 return true; |
| 1025 } | 996 } |
| 1026 }); | 997 }); |
| 1027 })(); | 998 })(); |
| OLD | NEW |