| 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 | 7 |
| 8 /* | 8 /* |
| 9 * Helper function to set hidden attribute for elements matching a selector. | 9 * Helper function to set hidden attribute for elements matching a selector. |
| 10 * @param {string} selector CSS selector for extracting a list of elements. | 10 * @param {string} selector CSS selector for extracting a list of elements. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 * @type {boolean} | 54 * @type {boolean} |
| 55 */ | 55 */ |
| 56 proxyListInitialized_: false, | 56 proxyListInitialized_: false, |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * Initializes DetailsInternetPage page. | 59 * Initializes DetailsInternetPage page. |
| 60 * Calls base class implementation to starts preference initialization. | 60 * Calls base class implementation to starts preference initialization. |
| 61 */ | 61 */ |
| 62 initializePage: function() { | 62 initializePage: function() { |
| 63 OptionsPage.prototype.initializePage.call(this); | 63 OptionsPage.prototype.initializePage.call(this); |
| 64 options.internet.CellularPlanElement.decorate($('planList')); |
| 65 this.initializePageContents_(); |
| 66 }, |
| 64 | 67 |
| 65 options.internet.CellularPlanElement.decorate($('planList')); | 68 /** |
| 66 | 69 * Initializes the contents of the page. |
| 70 */ |
| 71 initializePageContents_: function() { |
| 67 $('detailsInternetDismiss').addEventListener('click', function(event) { | 72 $('detailsInternetDismiss').addEventListener('click', function(event) { |
| 68 InternetOptions.setDetails(); | 73 InternetOptions.setDetails(); |
| 69 }); | 74 }); |
| 70 | 75 |
| 71 $('detailsInternetLogin').addEventListener('click', function(event) { | 76 $('detailsInternetLogin').addEventListener('click', function(event) { |
| 72 InternetOptions.setDetails(); | 77 InternetOptions.setDetails(); |
| 73 InternetOptions.loginFromDetails(); | 78 InternetOptions.loginFromDetails(); |
| 74 }); | 79 }); |
| 75 | 80 |
| 76 $('detailsInternetDisconnect').addEventListener('click', function(event) { | 81 $('detailsInternetDisconnect').addEventListener('click', function(event) { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 303 |
| 299 /** | 304 /** |
| 300 * Updates info banner visibility state. This function shows the banner | 305 * Updates info banner visibility state. This function shows the banner |
| 301 * if proxy is managed or shared-proxies is off for shared network. | 306 * if proxy is managed or shared-proxies is off for shared network. |
| 302 * @private | 307 * @private |
| 303 */ | 308 */ |
| 304 updateProxyBannerVisibility_: function() { | 309 updateProxyBannerVisibility_: function() { |
| 305 var bannerDiv = $('info-banner'); | 310 var bannerDiv = $('info-banner'); |
| 306 // Show banner and determine its message if necessary. | 311 // Show banner and determine its message if necessary. |
| 307 var controlledBy = $('directProxy').controlledBy; | 312 var controlledBy = $('directProxy').controlledBy; |
| 308 if (controlledBy == '') { | 313 if (!controlledBy || controlledBy == '') { |
| 309 bannerDiv.hidden = true; | 314 bannerDiv.hidden = true; |
| 310 } else { | 315 } else { |
| 311 bannerDiv.hidden = false; | 316 bannerDiv.hidden = false; |
| 312 // controlledBy must match strings loaded in proxy_handler.cc and | 317 // controlledBy must match strings loaded in proxy_handler.cc and |
| 313 // set in proxy_cros_settings_provider.cc. | 318 // set in proxy_cros_settings_provider.cc. |
| 314 $('banner-text').textContent = localStrings.getString(controlledBy); | 319 $('banner-text').textContent = localStrings.getString(controlledBy); |
| 315 } | 320 } |
| 316 }, | 321 }, |
| 317 | 322 |
| 318 /** | 323 /** |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 $('secureProxyHostName').disabled = all_disabled; | 380 $('secureProxyHostName').disabled = all_disabled; |
| 376 $('secureProxyPort').disabled = all_disabled; | 381 $('secureProxyPort').disabled = all_disabled; |
| 377 $('ftpProxy').disabled = all_disabled; | 382 $('ftpProxy').disabled = all_disabled; |
| 378 $('ftpProxyPort').disabled = all_disabled; | 383 $('ftpProxyPort').disabled = all_disabled; |
| 379 $('socksHost').disabled = all_disabled; | 384 $('socksHost').disabled = all_disabled; |
| 380 $('socksPort').disabled = all_disabled; | 385 $('socksPort').disabled = all_disabled; |
| 381 $('proxyConfig').disabled = true; | 386 $('proxyConfig').disabled = true; |
| 382 }, | 387 }, |
| 383 }; | 388 }; |
| 384 | 389 |
| 390 /** |
| 391 * Performs minimal initialization of the InternetDetails dialog in |
| 392 * preparation for showing proxy-setttings. |
| 393 */ |
| 394 DetailsInternetPage.initializeProxySettings = function() { |
| 395 var detailsPage = DetailsInternetPage.getInstance(); |
| 396 detailsPage.initializePageContents_(); |
| 397 }; |
| 398 |
| 399 /** |
| 400 * Displays the InternetDetails dialog with only the proxy settings visible. |
| 401 */ |
| 402 DetailsInternetPage.showProxySettings = function() { |
| 403 var detailsPage = DetailsInternetPage.getInstance(); |
| 404 $('network-details-header').hidden = true; |
| 405 $('buyplanDetails').hidden = true; |
| 406 $('activateDetails').hidden = true; |
| 407 $('viewAccountDetails').hidden = true; |
| 408 detailsPage.cellular = false; |
| 409 detailsPage.wireless = false; |
| 410 detailsPage.vpn = false; |
| 411 detailsPage.showProxy = true; |
| 412 updateHidden('#internetTab', true); |
| 413 updateHidden('#details-tab-strip', true); |
| 414 updateHidden('#detailsInternetPage .action-area', true); |
| 415 detailsPage.updateControls(); |
| 416 detailsPage.visible = true; |
| 417 }; |
| 418 |
| 385 return { | 419 return { |
| 386 DetailsInternetPage: DetailsInternetPage | 420 DetailsInternetPage: DetailsInternetPage |
| 387 }; | 421 }; |
| 388 }); | 422 }); |
| OLD | NEW |