| 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], | 12 behaviors: [CrPolicyNetworkBehavior], |
| 13 | 13 |
| 14 properties: { | 14 properties: { |
| 15 /** | 15 /** |
| 16 * The network properties dictionary containing the proxy properties to | 16 * The network properties dictionary containing the proxy properties to |
| 17 * display and modify. | 17 * display and modify. |
| 18 * @type {!CrOnc.NetworkProperties|undefined} | 18 * @type {!CrOnc.NetworkProperties|undefined} |
| 19 */ | 19 */ |
| 20 networkProperties: { | 20 networkProperties: { |
| 21 type: Object, | 21 type: Object, |
| 22 observer: 'networkPropertiesChanged_', | 22 observer: 'networkPropertiesChanged_', |
| 23 }, | 23 }, |
| 24 | 24 |
| 25 /** | 25 /** Whether or not the proxy values can be edited. */ |
| 26 * Whether or not the proxy values can be edited. | |
| 27 */ | |
| 28 editable: { | 26 editable: { |
| 29 type: Boolean, | 27 type: Boolean, |
| 30 value: false, | 28 value: false, |
| 31 }, | 29 }, |
| 32 | 30 |
| 33 /** | 31 /** |
| 34 * UI visible / edited proxy configuration. | 32 * UI visible / edited proxy configuration. |
| 35 * @type {!CrOnc.ProxySettings} | 33 * @type {!CrOnc.ProxySettings} |
| 36 */ | 34 */ |
| 37 proxy: { | 35 proxy: { |
| 38 type: Object, | 36 type: Object, |
| 39 value: function() { | 37 value: function() { |
| 40 return this.createDefaultProxySettings_(); | 38 return this.createDefaultProxySettings_(); |
| 41 }, | 39 }, |
| 42 }, | 40 }, |
| 43 | 41 |
| 44 /** | 42 /** The Web Proxy Auto Discovery URL extracted from networkProperties. */ |
| 45 * The Web Proxy Auto Discovery URL extracted from networkProperties. | |
| 46 */ | |
| 47 WPAD: { | 43 WPAD: { |
| 48 type: String, | 44 type: String, |
| 49 value: '', | 45 value: '', |
| 50 }, | 46 }, |
| 51 | 47 |
| 52 /** | 48 /** Whetner or not to use the same manual proxy for all protocols. */ |
| 53 * Whetner or not to use the same manual proxy for all protocols. | 49 useSameProxy_: { |
| 54 */ | |
| 55 useSameProxy: { | |
| 56 type: Boolean, | 50 type: Boolean, |
| 57 value: false, | 51 value: false, |
| 58 observer: 'useSameProxyChanged_', | 52 observer: 'useSameProxyChanged_', |
| 59 }, | 53 }, |
| 60 | 54 |
| 61 /** | 55 /** |
| 62 * Array of proxy configuration types. | 56 * Array of proxy configuration types. |
| 63 * @type {!Array<string>} | 57 * @type {!Array<string>} |
| 64 * @const | 58 * @const |
| 65 */ | 59 */ |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 /** | 171 /** |
| 178 * Called when the proxy changes in the UI. | 172 * Called when the proxy changes in the UI. |
| 179 */ | 173 */ |
| 180 sendProxyChange_: function() { | 174 sendProxyChange_: function() { |
| 181 if (this.proxy.Type == CrOnc.ProxySettingsType.MANUAL) { | 175 if (this.proxy.Type == CrOnc.ProxySettingsType.MANUAL) { |
| 182 var proxy = | 176 var proxy = |
| 183 /** @type {!CrOnc.ProxySettings} */ (Object.assign({}, this.proxy)); | 177 /** @type {!CrOnc.ProxySettings} */ (Object.assign({}, this.proxy)); |
| 184 var defaultProxy = proxy.Manual.HTTPProxy; | 178 var defaultProxy = proxy.Manual.HTTPProxy; |
| 185 if (!defaultProxy || !defaultProxy.Host) | 179 if (!defaultProxy || !defaultProxy.Host) |
| 186 return; | 180 return; |
| 187 if (this.useSameProxy || !proxy.Manual.SecureHTTPProxy) { | 181 if (this.useSameProxy_ || !proxy.Manual.SecureHTTPProxy) { |
| 188 proxy.Manual.SecureHTTPProxy = /** @type {!CrOnc.ProxyLocation} */ ( | 182 proxy.Manual.SecureHTTPProxy = /** @type {!CrOnc.ProxyLocation} */ ( |
| 189 Object.assign({}, defaultProxy)); | 183 Object.assign({}, defaultProxy)); |
| 190 } | 184 } |
| 191 if (this.useSameProxy || !proxy.Manual.FTPProxy) { | 185 if (this.useSameProxy_ || !proxy.Manual.FTPProxy) { |
| 192 proxy.Manual.FTPProxy = /** @type {!CrOnc.ProxyLocation} */ ( | 186 proxy.Manual.FTPProxy = /** @type {!CrOnc.ProxyLocation} */ ( |
| 193 Object.assign({}, defaultProxy)); | 187 Object.assign({}, defaultProxy)); |
| 194 } | 188 } |
| 195 if (this.useSameProxy || !proxy.Manual.SOCKS) { | 189 if (this.useSameProxy_ || !proxy.Manual.SOCKS) { |
| 196 proxy.Manual.SOCKS = /** @type {!CrOnc.ProxyLocation} */ ( | 190 proxy.Manual.SOCKS = /** @type {!CrOnc.ProxyLocation} */ ( |
| 197 Object.assign({}, defaultProxy)); | 191 Object.assign({}, defaultProxy)); |
| 198 } | 192 } |
| 199 this.savedManual_ = Object.assign({}, proxy.Manual); | 193 this.savedManual_ = Object.assign({}, proxy.Manual); |
| 200 this.savedExcludeDomains_ = proxy.ExcludeDomains; | 194 this.savedExcludeDomains_ = proxy.ExcludeDomains; |
| 201 this.proxy = proxy; | 195 this.proxy = proxy; |
| 202 } else if (this.proxy.Type == CrOnc.ProxySettingsType.PAC) { | 196 } else if (this.proxy.Type == CrOnc.ProxySettingsType.PAC) { |
| 203 if (!this.proxy.PAC) | 197 if (!this.proxy.PAC) |
| 204 return; | 198 return; |
| 205 } | 199 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 /** | 279 /** |
| 286 * @param {string} property The property to test | 280 * @param {string} property The property to test |
| 287 * @param {string} value The value to test against | 281 * @param {string} value The value to test against |
| 288 * @return {boolean} True if property == value | 282 * @return {boolean} True if property == value |
| 289 * @private | 283 * @private |
| 290 */ | 284 */ |
| 291 matches_: function(property, value) { | 285 matches_: function(property, value) { |
| 292 return property == value; | 286 return property == value; |
| 293 } | 287 } |
| 294 }); | 288 }); |
| OLD | NEW |