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], |
| 13 |
12 properties: { | 14 properties: { |
13 /** | 15 /** |
14 * The network properties dictionary containing the proxy properties to | 16 * The network properties dictionary containing the proxy properties to |
15 * display and modify. | 17 * display and modify. |
16 * @type {!CrOnc.NetworkProperties|undefined} | 18 * @type {!CrOnc.NetworkProperties|undefined} |
17 */ | 19 */ |
18 networkProperties: { | 20 networkProperties: { |
19 type: Object, | 21 type: Object, |
20 observer: 'networkPropertiesChanged_' | 22 observer: 'networkPropertiesChanged_' |
21 }, | 23 }, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 if (proxyType == CrOnc.ProxySettingsType.MANUAL) | 251 if (proxyType == CrOnc.ProxySettingsType.MANUAL) |
250 return 'Manual proxy configuration'; | 252 return 'Manual proxy configuration'; |
251 if (proxyType == CrOnc.ProxySettingsType.PAC) | 253 if (proxyType == CrOnc.ProxySettingsType.PAC) |
252 return 'Automatic proxy configuration'; | 254 return 'Automatic proxy configuration'; |
253 if (proxyType == CrOnc.ProxySettingsType.WPAD) | 255 if (proxyType == CrOnc.ProxySettingsType.WPAD) |
254 return 'Web proxy autodiscovery'; | 256 return 'Web proxy autodiscovery'; |
255 return 'Direct Internet connection'; | 257 return 'Direct Internet connection'; |
256 }, | 258 }, |
257 | 259 |
258 /** | 260 /** |
| 261 * @param {boolean} editable |
| 262 * @param {!CrOnc.NetworkProperties} networkProperties |
| 263 * @param {string} key |
| 264 * @return {boolean} Whether the property is editable. |
| 265 * @private |
| 266 */ |
| 267 isPropertyEditable_: function(editable, networkProperties, key) { |
| 268 if (!editable) |
| 269 return false; |
| 270 var property = /** @type {!CrOnc.NetworkProperty|undefined} */( |
| 271 this.get(key, networkProperties)); |
| 272 return !this.isNetworkPolicyEnforced(property); |
| 273 }, |
| 274 |
| 275 /** |
259 * @param {string} property The property to test | 276 * @param {string} property The property to test |
260 * @param {string} value The value to test against | 277 * @param {string} value The value to test against |
261 * @return {boolean} True if property == value | 278 * @return {boolean} True if property == value |
262 * @private | 279 * @private |
263 */ | 280 */ |
264 matches_: function(property, value) { | 281 matches_: function(property, value) { |
265 return property == value; | 282 return property == value; |
266 } | 283 } |
267 }); | 284 }); |
OLD | NEW |