OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('options.internet', function() { | 5 cr.define('options.internet', function() { |
6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
8 /** @const */ var IPAddressField = options.internet.IPAddressField; | 8 /** @const */ var IPAddressField = options.internet.IPAddressField; |
9 | 9 |
10 /** | 10 /** |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 // Proxy | 254 // Proxy |
255 options.proxyexceptions.ProxyExceptions.decorate($('ignored-host-list')); | 255 options.proxyexceptions.ProxyExceptions.decorate($('ignored-host-list')); |
256 $('remove-host').addEventListener('click', | 256 $('remove-host').addEventListener('click', |
257 this.handleRemoveProxyExceptions_); | 257 this.handleRemoveProxyExceptions_); |
258 $('add-host').addEventListener('click', this.handleAddProxyException_); | 258 $('add-host').addEventListener('click', this.handleAddProxyException_); |
259 $('direct-proxy').addEventListener('click', this.disableManualProxy_); | 259 $('direct-proxy').addEventListener('click', this.disableManualProxy_); |
260 $('manual-proxy').addEventListener('click', this.enableManualProxy_); | 260 $('manual-proxy').addEventListener('click', this.enableManualProxy_); |
261 $('auto-proxy').addEventListener('click', this.disableManualProxy_); | 261 $('auto-proxy').addEventListener('click', this.disableManualProxy_); |
262 $('proxy-all-protocols').addEventListener('click', | 262 $('proxy-all-protocols').addEventListener('click', |
263 this.toggleSingleProxy_); | 263 this.toggleSingleProxy_); |
264 $('proxy-config-url').addEventListener('click', | |
265 this.toggleAutoConfigProxy_); | |
264 | 266 |
265 observePrefsUI($('direct-proxy')); | 267 observePrefsUI($('direct-proxy')); |
266 observePrefsUI($('manual-proxy')); | 268 observePrefsUI($('manual-proxy')); |
267 observePrefsUI($('auto-proxy')); | 269 observePrefsUI($('auto-proxy')); |
268 observePrefsUI($('proxy-all-protocols')); | 270 observePrefsUI($('proxy-all-protocols')); |
271 observePrefsUI($('proxy-config-url')); | |
269 | 272 |
270 $('ip-automatic-configuration-checkbox').addEventListener('click', | 273 $('ip-automatic-configuration-checkbox').addEventListener('click', |
271 this.handleIpAutoConfig_); | 274 this.handleIpAutoConfig_); |
272 $('automatic-dns-radio').addEventListener('click', | 275 $('automatic-dns-radio').addEventListener('click', |
273 this.handleNameServerTypeChange_); | 276 this.handleNameServerTypeChange_); |
274 $('google-dns-radio').addEventListener('click', | 277 $('google-dns-radio').addEventListener('click', |
275 this.handleNameServerTypeChange_); | 278 this.handleNameServerTypeChange_); |
276 $('user-dns-radio').addEventListener('click', | 279 $('user-dns-radio').addEventListener('click', |
277 this.handleNameServerTypeChange_); | 280 this.handleNameServerTypeChange_); |
278 | 281 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 if ($('proxy-all-protocols').checked) { | 426 if ($('proxy-all-protocols').checked) { |
424 $('multi-proxy').hidden = true; | 427 $('multi-proxy').hidden = true; |
425 $('single-proxy').hidden = false; | 428 $('single-proxy').hidden = false; |
426 } else { | 429 } else { |
427 $('multi-proxy').hidden = false; | 430 $('multi-proxy').hidden = false; |
428 $('single-proxy').hidden = true; | 431 $('single-proxy').hidden = true; |
429 } | 432 } |
430 }, | 433 }, |
431 | 434 |
432 /** | 435 /** |
436 * Handler for when the user clicks on the checkbox to enter | |
437 * auto configuration URL. | |
438 * @private | |
439 * @param {Event} e Click Event. | |
440 */ | |
441 toggleAutoConfigProxy_: function(e) { | |
442 if ($('proxy-config-url').checked) { | |
443 $('proxy-config').disabled = false; | |
444 } else { | |
445 $('proxy-config').disabled = true; | |
446 $('proxy-config').textContent = ''; | |
Dan Beam
2013/04/04 00:53:59
^ hmmm, why do you want to clear the text content?
| |
447 } | |
448 }, | |
449 | |
450 /** | |
433 * Handler for selecting a radio button that will disable the manual | 451 * Handler for selecting a radio button that will disable the manual |
434 * controls. | 452 * controls. |
435 * @private | 453 * @private |
436 * @param {Event} e Click event. | 454 * @param {Event} e Click event. |
437 */ | 455 */ |
438 disableManualProxy_: function(e) { | 456 disableManualProxy_: function(e) { |
439 $('advanced-config').hidden = true; | 457 $('advanced-config').hidden = true; |
440 $('proxy-all-protocols').disabled = true; | 458 $('proxy-all-protocols').disabled = true; |
441 $('proxy-host-name').disabled = true; | 459 $('proxy-host-name').disabled = true; |
442 $('proxy-host-port').disabled = true; | 460 $('proxy-host-port').disabled = true; |
443 $('proxy-host-single-name').disabled = true; | 461 $('proxy-host-single-name').disabled = true; |
444 $('proxy-host-single-port').disabled = true; | 462 $('proxy-host-single-port').disabled = true; |
445 $('secure-proxy-host-name').disabled = true; | 463 $('secure-proxy-host-name').disabled = true; |
446 $('secure-proxy-port').disabled = true; | 464 $('secure-proxy-port').disabled = true; |
447 $('ftp-proxy').disabled = true; | 465 $('ftp-proxy').disabled = true; |
448 $('ftp-proxy-port').disabled = true; | 466 $('ftp-proxy-port').disabled = true; |
449 $('socks-host').disabled = true; | 467 $('socks-host').disabled = true; |
450 $('socks-port').disabled = true; | 468 $('socks-port').disabled = true; |
451 $('proxy-config').disabled = $('auto-proxy').disabled || | 469 $('proxy-config').disabled = $('proxy-config-url').disabled || |
470 !$('proxy-config-url').checked; | |
471 $('proxy-config-url').disabled = $('auto-proxy').disabled || | |
452 !$('auto-proxy').checked; | 472 !$('auto-proxy').checked; |
Dan Beam
2013/04/04 00:53:59
nit: line this up like this:
$('proxy-config-ur
| |
453 }, | 473 }, |
454 | 474 |
455 /** | 475 /** |
456 * Handler for selecting a radio button that will enable the manual | 476 * Handler for selecting a radio button that will enable the manual |
457 * controls. | 477 * controls. |
458 * @private | 478 * @private |
459 * @param {Event} e Click event. | 479 * @param {Event} e Click event. |
460 */ | 480 */ |
461 enableManualProxy_: function(e) { | 481 enableManualProxy_: function(e) { |
462 $('advanced-config').hidden = false; | 482 $('advanced-config').hidden = false; |
463 $('ignored-host-list').redraw(); | 483 $('ignored-host-list').redraw(); |
464 var allDisabled = $('manual-proxy').disabled; | 484 var allDisabled = $('manual-proxy').disabled; |
465 $('new-host').disabled = allDisabled; | 485 $('new-host').disabled = allDisabled; |
466 $('remove-host').disabled = allDisabled; | 486 $('remove-host').disabled = allDisabled; |
467 $('add-host').disabled = allDisabled; | 487 $('add-host').disabled = allDisabled; |
468 $('proxy-all-protocols').disabled = allDisabled; | 488 $('proxy-all-protocols').disabled = allDisabled; |
469 $('proxy-host-name').disabled = allDisabled; | 489 $('proxy-host-name').disabled = allDisabled; |
470 $('proxy-host-port').disabled = allDisabled; | 490 $('proxy-host-port').disabled = allDisabled; |
471 $('proxy-host-single-name').disabled = allDisabled; | 491 $('proxy-host-single-name').disabled = allDisabled; |
472 $('proxy-host-single-port').disabled = allDisabled; | 492 $('proxy-host-single-port').disabled = allDisabled; |
473 $('secure-proxy-host-name').disabled = allDisabled; | 493 $('secure-proxy-host-name').disabled = allDisabled; |
474 $('secure-proxy-port').disabled = allDisabled; | 494 $('secure-proxy-port').disabled = allDisabled; |
475 $('ftp-proxy').disabled = allDisabled; | 495 $('ftp-proxy').disabled = allDisabled; |
476 $('ftp-proxy-port').disabled = allDisabled; | 496 $('ftp-proxy-port').disabled = allDisabled; |
477 $('socks-host').disabled = allDisabled; | 497 $('socks-host').disabled = allDisabled; |
478 $('socks-port').disabled = allDisabled; | 498 $('socks-port').disabled = allDisabled; |
479 $('proxy-config').disabled = true; | 499 $('proxy-config').disabled = true; |
500 $('proxy-config-url').disabled = true; | |
480 }, | 501 }, |
481 }; | 502 }; |
482 | 503 |
483 /** | 504 /** |
484 * Enables or Disables all buttons that provide operations on the cellular | 505 * Enables or Disables all buttons that provide operations on the cellular |
485 * network. | 506 * network. |
486 */ | 507 */ |
487 DetailsInternetPage.changeCellularButtonsState = function(disable) { | 508 DetailsInternetPage.changeCellularButtonsState = function(disable) { |
488 var buttonsToDisableList = | 509 var buttonsToDisableList = |
489 new Array('details-internet-login', | 510 new Array('details-internet-login', |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1123 | 1144 |
1124 // Don't show page name in address bar and in history to prevent people | 1145 // Don't show page name in address bar and in history to prevent people |
1125 // navigate here by hand and solve issue with page session restore. | 1146 // navigate here by hand and solve issue with page session restore. |
1126 OptionsPage.showPageByName('detailsInternetPage', false); | 1147 OptionsPage.showPageByName('detailsInternetPage', false); |
1127 }; | 1148 }; |
1128 | 1149 |
1129 return { | 1150 return { |
1130 DetailsInternetPage: DetailsInternetPage | 1151 DetailsInternetPage: DetailsInternetPage |
1131 }; | 1152 }; |
1132 }); | 1153 }); |
OLD | NEW |