| 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 Polymer element for displaying and editing network proxy | 6 * @fileoverview Polymer element for displaying and editing network proxy |
| 7 * values. | 7 * values. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'network-proxy', | 10 is: 'network-proxy', |
| 11 | 11 |
| 12 behaviors: [CrPolicyNetworkBehavior, I18nBehavior, PrefsBehavior], | 12 behaviors: [ |
| 13 CrPolicyNetworkBehavior, |
| 14 I18nBehavior, |
| 15 PrefsBehavior, |
| 16 settings.RouteObserverBehavior, |
| 17 ], |
| 13 | 18 |
| 14 properties: { | 19 properties: { |
| 15 /** | 20 /** |
| 16 * The network properties dictionary containing the proxy properties to | 21 * The network properties dictionary containing the proxy properties to |
| 17 * display and modify. | 22 * display and modify. |
| 18 * @type {!CrOnc.NetworkProperties|undefined} | 23 * @type {!CrOnc.NetworkProperties|undefined} |
| 19 */ | 24 */ |
| 20 networkProperties: { | 25 networkProperties: { |
| 21 type: Object, | 26 type: Object, |
| 22 observer: 'networkPropertiesChanged_', | 27 observer: 'networkPropertiesChanged_', |
| 23 }, | 28 }, |
| 24 | 29 |
| 25 /** Whether or not the proxy values can be edited. */ | 30 /** Whether or not the proxy values can be edited. */ |
| 26 editable: { | 31 editable: { |
| 27 type: Boolean, | 32 type: Boolean, |
| 28 value: false, | 33 value: false, |
| 29 }, | 34 }, |
| 30 | 35 |
| 31 /** | 36 /** |
| 32 * UI visible / edited proxy configuration. | 37 * UI visible / edited proxy configuration. |
| 33 * @type {!CrOnc.ProxySettings} | 38 * @private {!CrOnc.ProxySettings} |
| 34 */ | 39 */ |
| 35 proxy: { | 40 proxy_: { |
| 36 type: Object, | 41 type: Object, |
| 37 value: function() { | 42 value: function() { |
| 38 return this.createDefaultProxySettings_(); | 43 return this.createDefaultProxySettings_(); |
| 39 }, | 44 }, |
| 40 }, | 45 }, |
| 41 | 46 |
| 42 /** The Web Proxy Auto Discovery URL extracted from networkProperties. */ | 47 /** |
| 43 WPAD: { | 48 * The Web Proxy Auto Discovery URL extracted from networkProperties. |
| 49 * @private |
| 50 */ |
| 51 WPAD_: { |
| 44 type: String, | 52 type: String, |
| 45 value: '', | 53 value: '', |
| 46 }, | 54 }, |
| 47 | 55 |
| 48 /** | 56 /** |
| 49 * Whether or not to use the same manual proxy for all protocols. | 57 * Whether or not to use the same manual proxy for all protocols. |
| 50 * @private | 58 * @private |
| 51 */ | 59 */ |
| 52 useSameProxy_: { | 60 useSameProxy_: { |
| 53 type: Boolean, | 61 type: Boolean, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 savedManual_: undefined, | 114 savedManual_: undefined, |
| 107 | 115 |
| 108 /** | 116 /** |
| 109 * Saved ExcludeDomains properties so that switching to a non-Manual type does | 117 * Saved ExcludeDomains properties so that switching to a non-Manual type does |
| 110 * not loose any set exclusions while the UI is open. | 118 * not loose any set exclusions while the UI is open. |
| 111 * @private {!Array<string>|undefined} | 119 * @private {!Array<string>|undefined} |
| 112 */ | 120 */ |
| 113 savedExcludeDomains_: undefined, | 121 savedExcludeDomains_: undefined, |
| 114 | 122 |
| 115 /** | 123 /** |
| 116 * Set to true the first time we receive a manual proxy. Used to set the | 124 * Set to true while modifying proxy values so that an update does not |
| 117 * initial |useSameProxy_| value. | 125 * override the edited values. |
| 118 * @private {boolean} | 126 * @private {boolean} |
| 119 */ | 127 */ |
| 120 receivedManualProxy_: false, | 128 proxyModified_: false, |
| 129 |
| 130 /** @protected settings.RouteObserverBehavior */ |
| 131 currentRouteChanged: function(newRoute) { |
| 132 this.proxyModified_ = false; |
| 133 this.proxy_ = this.createDefaultProxySettings_(); |
| 134 if (newRoute == settings.Route.NETWORK_DETAIL) |
| 135 this.updateProxy_(); |
| 136 }, |
| 121 | 137 |
| 122 /** @private */ | 138 /** @private */ |
| 123 networkPropertiesChanged_: function() { | 139 networkPropertiesChanged_: function() { |
| 140 if (this.proxyModified_) |
| 141 return; // Ignore update. |
| 124 this.updateProxy_(); | 142 this.updateProxy_(); |
| 125 }, | 143 }, |
| 126 | 144 |
| 127 /** @private */ | 145 /** @private */ |
| 128 updateProxy_: function() { | 146 updateProxy_: function() { |
| 129 if (!this.networkProperties) | 147 if (!this.networkProperties) |
| 130 return; | 148 return; |
| 131 | 149 |
| 132 /** @type {!CrOnc.ProxySettings} */ | 150 /** @type {!CrOnc.ProxySettings} */ |
| 133 var proxy = this.createDefaultProxySettings_(); | 151 var proxy = this.createDefaultProxySettings_(); |
| 134 | 152 |
| 135 // For shared networks with unmanaged proxy settings, ignore any saved | 153 // For shared networks with unmanaged proxy settings, ignore any saved |
| 136 // proxy settings (use the default values). | 154 // proxy settings (use the default values). |
| 137 if (this.isShared_()) { | 155 if (this.isShared_()) { |
| 138 let property = this.getProxySettingsTypeProperty_(); | 156 let property = this.getProxySettingsTypeProperty_(); |
| 139 if (!this.isControlled(property) && !this.useSharedProxies_) { | 157 if (!this.isControlled(property) && !this.useSharedProxies_) { |
| 140 this.setProxyAsync_(proxy); | 158 this.setProxyAsync_(proxy); |
| 141 return; // Proxy settings will be ignored. | 159 return; // Proxy settings will be ignored. |
| 142 } | 160 } |
| 143 } | 161 } |
| 144 | 162 |
| 145 /** @type {!chrome.networkingPrivate.ManagedProxySettings|undefined} */ | 163 /** @type {!chrome.networkingPrivate.ManagedProxySettings|undefined} */ |
| 146 var proxySettings = this.networkProperties.ProxySettings; | 164 var proxySettings = this.networkProperties.ProxySettings; |
| 147 if (proxySettings) { | 165 if (proxySettings) { |
| 148 proxy.Type = /** @type {!CrOnc.ProxySettingsType} */ ( | 166 proxy.Type = /** @type {!CrOnc.ProxySettingsType} */ ( |
| 149 CrOnc.getActiveValue(proxySettings.Type)); | 167 CrOnc.getActiveValue(proxySettings.Type)); |
| 150 if (proxySettings.Manual) { | 168 if (proxySettings.Manual) { |
| 151 proxy.Manual.HTTPProxy = /** @type {!CrOnc.ProxyLocation|undefined} */ ( | 169 proxy.Manual.HTTPProxy = /** @type {!CrOnc.ProxyLocation|undefined} */ ( |
| 152 CrOnc.getSimpleActiveProperties(proxySettings.Manual.HTTPProxy)); | 170 CrOnc.getSimpleActiveProperties( |
| 171 proxySettings.Manual.HTTPProxy)) || |
| 172 {Host: '', Port: 80}; |
| 153 proxy.Manual.SecureHTTPProxy = | 173 proxy.Manual.SecureHTTPProxy = |
| 154 /** @type {!CrOnc.ProxyLocation|undefined} */ ( | 174 /** @type {!CrOnc.ProxyLocation|undefined} */ ( |
| 155 CrOnc.getSimpleActiveProperties( | 175 CrOnc.getSimpleActiveProperties( |
| 156 proxySettings.Manual.SecureHTTPProxy)); | 176 proxySettings.Manual.SecureHTTPProxy)) || |
| 157 proxy.Manual.FTPProxy = /** @type {!CrOnc.ProxyLocation|undefined} */ ( | 177 proxy.Manual.HTTPProxy; |
| 158 CrOnc.getSimpleActiveProperties(proxySettings.Manual.FTPProxy)); | 178 proxy.Manual.FTPProxy = |
| 159 proxy.Manual.SOCKS = /** @type {!CrOnc.ProxyLocation|undefined} */ ( | 179 /** @type {!CrOnc.ProxyLocation|undefined} */ ( |
| 160 CrOnc.getSimpleActiveProperties(proxySettings.Manual.SOCKS)); | 180 CrOnc.getSimpleActiveProperties( |
| 161 if (!this.receivedManualProxy_) { | 181 proxySettings.Manual.FTPProxy)) || |
| 162 let json_http = JSON.stringify(proxy.Manual.HTTPProxy); | 182 proxy.Manual.HTTPProxy; |
| 163 this.useSameProxy_ = | 183 proxy.Manual.SOCKS = |
| 164 json_http == JSON.stringify(proxy.Manual.SecureHTTPProxy) && | 184 /** @type {!CrOnc.ProxyLocation|undefined} */ ( |
| 165 json_http == JSON.stringify(proxy.Manual.FTPProxy) && | 185 CrOnc.getSimpleActiveProperties(proxySettings.Manual.SOCKS)) || |
| 166 json_http == JSON.stringify(proxy.Manual.SOCKS); | 186 proxy.Manual.HTTPProxy; |
| 167 this.receivedManualProxy_ = true; | 187 let json_http = JSON.stringify(proxy.Manual.HTTPProxy); |
| 168 } | 188 this.useSameProxy_ = |
| 189 json_http == JSON.stringify(proxy.Manual.SecureHTTPProxy) && |
| 190 json_http == JSON.stringify(proxy.Manual.FTPProxy) && |
| 191 json_http == JSON.stringify(proxy.Manual.SOCKS); |
| 169 } | 192 } |
| 170 if (proxySettings.ExcludeDomains) { | 193 if (proxySettings.ExcludeDomains) { |
| 171 proxy.ExcludeDomains = /** @type {!Array<string>|undefined} */ ( | 194 proxy.ExcludeDomains = /** @type {!Array<string>|undefined} */ ( |
| 172 CrOnc.getActiveValue(proxySettings.ExcludeDomains)); | 195 CrOnc.getActiveValue(proxySettings.ExcludeDomains)); |
| 173 } | 196 } |
| 174 proxy.PAC = /** @type {string|undefined} */ ( | 197 proxy.PAC = /** @type {string|undefined} */ ( |
| 175 CrOnc.getActiveValue(proxySettings.PAC)); | 198 CrOnc.getActiveValue(proxySettings.PAC)); |
| 176 } | 199 } |
| 177 // Use saved ExcludeDomanains and Manual if not defined. | 200 // Use saved ExcludeDomanains and Manual if not defined. |
| 178 proxy.ExcludeDomains = proxy.ExcludeDomains || this.savedExcludeDomains_; | 201 proxy.ExcludeDomains = proxy.ExcludeDomains || this.savedExcludeDomains_; |
| 179 proxy.Manual = proxy.Manual || this.savedManual_; | 202 proxy.Manual = proxy.Manual || this.savedManual_; |
| 180 | 203 |
| 181 // Set the Web Proxy Auto Discovery URL. | 204 // Set the Web Proxy Auto Discovery URL. |
| 182 var ipv4 = | 205 var ipv4 = |
| 183 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); | 206 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); |
| 184 this.WPAD = (ipv4 && ipv4.WebProxyAutoDiscoveryUrl) || ''; | 207 this.WPAD_ = (ipv4 && ipv4.WebProxyAutoDiscoveryUrl) || ''; |
| 185 | 208 |
| 186 this.setProxyAsync_(proxy); | 209 this.setProxyAsync_(proxy); |
| 187 }, | 210 }, |
| 188 | 211 |
| 189 /** | 212 /** |
| 190 * @param {!CrOnc.ProxySettings} proxy | 213 * @param {!CrOnc.ProxySettings} proxy |
| 191 * @private | 214 * @private |
| 192 */ | 215 */ |
| 193 setProxyAsync_: function(proxy) { | 216 setProxyAsync_: function(proxy) { |
| 194 // Set this.proxy after dom-repeat has been stamped. | 217 // Set this.proxy_ after dom-repeat has been stamped. |
| 195 this.async(function() { | 218 this.async(function() { |
| 196 this.proxy = proxy; | 219 this.proxy_ = proxy; |
| 220 this.proxyModified_ = false; |
| 197 }.bind(this)); | 221 }.bind(this)); |
| 198 }, | 222 }, |
| 199 | 223 |
| 200 /** @private */ | 224 /** @private */ |
| 201 useSameProxyChanged_: function() { | 225 useSameProxyChanged_: function() { |
| 202 if (!this.receivedManualProxy_) | 226 this.proxyModified_ = true; |
| 203 return; | |
| 204 this.sendProxyChange_(); | |
| 205 }, | 227 }, |
| 206 | 228 |
| 207 /** @private */ | 229 /** @private */ |
| 208 useSharedProxiesChanged_: function() { | 230 useSharedProxiesChanged_: function() { |
| 209 let pref = this.getPref('settings.use_shared_proxies'); | 231 let pref = this.getPref('settings.use_shared_proxies'); |
| 210 this.useSharedProxies_ = !!pref && !!pref.value; | 232 this.useSharedProxies_ = !!pref && !!pref.value; |
| 211 this.updateProxy_(); | 233 this.updateProxy_(); |
| 212 }, | 234 }, |
| 213 | 235 |
| 214 /** | 236 /** |
| (...skipping 12 matching lines...) Expand all Loading... |
| 227 }, | 249 }, |
| 228 PAC: '' | 250 PAC: '' |
| 229 }; | 251 }; |
| 230 }, | 252 }, |
| 231 | 253 |
| 232 /** | 254 /** |
| 233 * Called when the proxy changes in the UI. | 255 * Called when the proxy changes in the UI. |
| 234 * @private | 256 * @private |
| 235 */ | 257 */ |
| 236 sendProxyChange_: function() { | 258 sendProxyChange_: function() { |
| 237 if (this.proxy.Type == CrOnc.ProxySettingsType.MANUAL) { | 259 if (this.proxy_.Type == CrOnc.ProxySettingsType.MANUAL) { |
| 238 var proxy = | 260 let proxy = |
| 239 /** @type {!CrOnc.ProxySettings} */ (Object.assign({}, this.proxy)); | 261 /** @type {!CrOnc.ProxySettings} */ (Object.assign({}, this.proxy_)); |
| 240 var defaultProxy = proxy.Manual.HTTPProxy; | 262 let manual = proxy.Manual; |
| 263 let defaultProxy = manual.HTTPProxy; |
| 241 if (!defaultProxy || !defaultProxy.Host) | 264 if (!defaultProxy || !defaultProxy.Host) |
| 242 return; | 265 return; |
| 243 if (this.useSameProxy_ || !proxy.Manual.SecureHTTPProxy) { | 266 if (this.useSameProxy_ || !this.get('SecureHTTPProxy.Host', manual)) { |
| 244 proxy.Manual.SecureHTTPProxy = /** @type {!CrOnc.ProxyLocation} */ ( | 267 proxy.Manual.SecureHTTPProxy = /** @type {!CrOnc.ProxyLocation} */ ( |
| 245 Object.assign({}, defaultProxy)); | 268 Object.assign({}, defaultProxy)); |
| 246 } | 269 } |
| 247 if (this.useSameProxy_ || !proxy.Manual.FTPProxy) { | 270 if (this.useSameProxy_ || !this.get('FTPProxy.Host', manual)) { |
| 248 proxy.Manual.FTPProxy = /** @type {!CrOnc.ProxyLocation} */ ( | 271 proxy.Manual.FTPProxy = /** @type {!CrOnc.ProxyLocation} */ ( |
| 249 Object.assign({}, defaultProxy)); | 272 Object.assign({}, defaultProxy)); |
| 250 } | 273 } |
| 251 if (this.useSameProxy_ || !proxy.Manual.SOCKS) { | 274 if (this.useSameProxy_ || !this.get('SOCKS.Host', manual)) { |
| 252 proxy.Manual.SOCKS = /** @type {!CrOnc.ProxyLocation} */ ( | 275 proxy.Manual.SOCKS = /** @type {!CrOnc.ProxyLocation} */ ( |
| 253 Object.assign({}, defaultProxy)); | 276 Object.assign({}, defaultProxy)); |
| 254 } | 277 } |
| 255 this.savedManual_ = Object.assign({}, proxy.Manual); | 278 this.savedManual_ = Object.assign({}, proxy.Manual); |
| 256 this.savedExcludeDomains_ = proxy.ExcludeDomains; | 279 this.savedExcludeDomains_ = proxy.ExcludeDomains; |
| 257 this.proxy = proxy; | 280 this.proxy_ = proxy; |
| 258 } else if (this.proxy.Type == CrOnc.ProxySettingsType.PAC) { | 281 } else if (this.proxy_.Type == CrOnc.ProxySettingsType.PAC) { |
| 259 if (!this.proxy.PAC) | 282 if (!this.proxy_.PAC) |
| 260 return; | 283 return; |
| 261 } | 284 } |
| 262 this.fire('proxy-change', {field: 'ProxySettings', value: this.proxy}); | 285 this.fire('proxy-change', {field: 'ProxySettings', value: this.proxy_}); |
| 286 this.proxyModified_ = false; |
| 263 }, | 287 }, |
| 264 | 288 |
| 265 /** | 289 /** |
| 266 * Event triggered when the selected proxy type changes. | 290 * Event triggered when the selected proxy type changes. |
| 267 * @param {!Event} event | 291 * @param {!Event} event |
| 268 * @private | 292 * @private |
| 269 */ | 293 */ |
| 270 onTypeChange_: function(event) { | 294 onTypeChange_: function(event) { |
| 271 let target = /** @type {!HTMLSelectElement} */ (event.target); | 295 let target = /** @type {!HTMLSelectElement} */ (event.target); |
| 272 var type = /** @type {chrome.networkingPrivate.ProxySettingsType} */ ( | 296 var type = /** @type {chrome.networkingPrivate.ProxySettingsType} */ ( |
| 273 target.value); | 297 target.value); |
| 274 this.set('proxy.Type', type); | 298 this.set('proxy_.Type', type); |
| 299 if (type == CrOnc.ProxySettingsType.MANUAL) |
| 300 this.proxyModified_ = true; |
| 301 else |
| 302 this.sendProxyChange_(); |
| 303 }, |
| 304 |
| 305 /** @private */ |
| 306 onPACChange_: function() { |
| 275 this.sendProxyChange_(); | 307 this.sendProxyChange_(); |
| 276 }, | 308 }, |
| 277 | 309 |
| 278 /** | 310 /** @private */ |
| 279 * Event triggered when a proxy value changes. | 311 onProxyInputChange_: function() { |
| 280 * @param {Event} event The proxy value change event. | 312 this.proxyModified_ = true; |
| 281 * @private | |
| 282 */ | |
| 283 onProxyInputChange_: function(event) { | |
| 284 this.sendProxyChange_(); | |
| 285 }, | 313 }, |
| 286 | 314 |
| 287 /** | 315 /** |
| 288 * Event triggered when a proxy exclusion is added. | 316 * Event triggered when a proxy exclusion is added. |
| 289 * @param {Event} event The add proxy exclusion event. | 317 * @param {Event} event The add proxy exclusion event. |
| 290 * @private | 318 * @private |
| 291 */ | 319 */ |
| 292 onAddProxyExclusionTap_: function(event) { | 320 onAddProxyExclusionTap_: function(event) { |
| 293 var value = this.$.proxyExclusion.value; | 321 var value = this.$.proxyExclusion.value; |
| 294 if (!value) | 322 if (!value) |
| 295 return; | 323 return; |
| 296 this.push('proxy.ExcludeDomains', value); | 324 this.push('proxy_.ExcludeDomains', value); |
| 297 // Clear input. | 325 // Clear input. |
| 298 this.$.proxyExclusion.value = ''; | 326 this.$.proxyExclusion.value = ''; |
| 299 this.sendProxyChange_(); | 327 this.proxyModified_ = true; |
| 300 }, | 328 }, |
| 301 | 329 |
| 302 /** | 330 /** |
| 303 * Event triggered when the proxy exclusion list changes. | 331 * Event triggered when the proxy exclusion list changes. |
| 304 * @param {Event} event The remove proxy exclusions change event. | 332 * @param {Event} event The remove proxy exclusions change event. |
| 305 * @private | 333 * @private |
| 306 */ | 334 */ |
| 307 onProxyExclusionsChange_: function(event) { | 335 onProxyExclusionsChange_: function(event) { |
| 336 this.proxyModified_ = true; |
| 337 }, |
| 338 |
| 339 /** @private */ |
| 340 onSaveProxyTap_: function() { |
| 308 this.sendProxyChange_(); | 341 this.sendProxyChange_(); |
| 309 }, | 342 }, |
| 310 | 343 |
| 311 /** | 344 /** |
| 312 * @param {string} proxyType The proxy type. | 345 * @param {string} proxyType The proxy type. |
| 313 * @return {string} The description for |proxyType|. | 346 * @return {string} The description for |proxyType|. |
| 314 * @private | 347 * @private |
| 315 */ | 348 */ |
| 316 getProxyTypeDesc_: function(proxyType) { | 349 getProxyTypeDesc_: function(proxyType) { |
| 317 if (proxyType == CrOnc.ProxySettingsType.MANUAL) | 350 if (proxyType == CrOnc.ProxySettingsType.MANUAL) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 /** | 387 /** |
| 355 * @param {!CrOnc.ManagedProperty} property | 388 * @param {!CrOnc.ManagedProperty} property |
| 356 * @return {boolean} | 389 * @return {boolean} |
| 357 * @private | 390 * @private |
| 358 */ | 391 */ |
| 359 shouldShowAllowShared_: function(property) { | 392 shouldShowAllowShared_: function(property) { |
| 360 return !this.isControlled(property) && this.isShared_(); | 393 return !this.isControlled(property) && this.isShared_(); |
| 361 }, | 394 }, |
| 362 | 395 |
| 363 /** | 396 /** |
| 397 * @param {string} propertyName |
| 398 * @return {boolean} Whether the named property setting is editable. |
| 399 * @private |
| 400 */ |
| 401 isEditable_: function(propertyName) { |
| 402 if (!this.editable || (this.isShared_() && !this.useSharedProxies_)) |
| 403 return false; |
| 404 if (!this.networkProperties.hasOwnProperty('ProxySettings')) |
| 405 return true; // No proxy settings defined, so not enforced. |
| 406 let property = /** @type {!CrOnc.ManagedProperty|undefined} */ ( |
| 407 this.get('ProxySettings.' + propertyName, this.networkProperties)); |
| 408 if (!property) |
| 409 return true; |
| 410 return this.isPropertyEditable_(property); |
| 411 }, |
| 412 |
| 413 /** |
| 364 * @param {!CrOnc.ManagedProperty|undefined} property | 414 * @param {!CrOnc.ManagedProperty|undefined} property |
| 365 * @return {boolean} Whether the property setting is enforced. | 415 * @return {boolean} Whether |property| is editable. |
| 366 * @private | 416 * @private |
| 367 */ | 417 */ |
| 368 isEditable_: function(property) { | 418 isPropertyEditable_: function(property) { |
| 369 return this.editable && !this.isNetworkPolicyEnforced(property) && | 419 return !this.isNetworkPolicyEnforced(property) && |
| 370 !this.isExtensionControlled(property) && | 420 !this.isExtensionControlled(property); |
| 371 (!this.isShared_() || this.useSharedProxies_); | |
| 372 }, | 421 }, |
| 373 | 422 |
| 374 /** | 423 /** |
| 375 * @return {boolean} | 424 * @return {boolean} |
| 376 * @private | 425 * @private |
| 377 */ | 426 */ |
| 378 isShared_: function() { | 427 isShared_: function() { |
| 379 return this.networkProperties.Source == 'Device' || | 428 return this.networkProperties.Source == 'Device' || |
| 380 this.networkProperties.Source == 'DevicePolicy'; | 429 this.networkProperties.Source == 'DevicePolicy'; |
| 381 }, | 430 }, |
| 382 | 431 |
| 383 /** | 432 /** |
| 384 * Used to check the editable state for proxy related UI that may or may | 433 * @return {boolean} |
| 385 * not be directly controlled by a policy. We use the enforced state of the | |
| 386 * 'ProxySettings.Type' property for these controls. | |
| 387 * @return {boolean} Whether the proxy control is editable. | |
| 388 * @private | 434 * @private |
| 389 */ | 435 */ |
| 390 isProxyEditable_: function() { | 436 isSaveManualProxyEnabled_: function() { |
| 391 let property = this.getProxySettingsTypeProperty_(); | 437 if (!this.proxyModified_) |
| 392 return !property || this.isEditable_(property); | 438 return false; |
| 439 return !!this.get('HTTPProxy.Host', this.proxy_.Manual); |
| 393 }, | 440 }, |
| 394 | 441 |
| 395 /** | 442 /** |
| 396 * @param {string} property The property to test | 443 * @param {string} property The property to test |
| 397 * @param {string} value The value to test against | 444 * @param {string} value The value to test against |
| 398 * @return {boolean} True if property == value | 445 * @return {boolean} True if property == value |
| 399 * @private | 446 * @private |
| 400 */ | 447 */ |
| 401 matches_: function(property, value) { | 448 matches_: function(property, value) { |
| 402 return property == value; | 449 return property == value; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 426 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel | 473 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel |
| 427 * event. | 474 * event. |
| 428 * @private | 475 * @private |
| 429 */ | 476 */ |
| 430 onAllowSharedDialogCancel_: function() { | 477 onAllowSharedDialogCancel_: function() { |
| 431 /** @type {!SettingsCheckboxElement} */ (this.$.allowShared) | 478 /** @type {!SettingsCheckboxElement} */ (this.$.allowShared) |
| 432 .resetToPrefValue(); | 479 .resetToPrefValue(); |
| 433 this.$.confirmAllowSharedDialog.close(); | 480 this.$.confirmAllowSharedDialog.close(); |
| 434 }, | 481 }, |
| 435 }); | 482 }); |
| OLD | NEW |