Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1549)

Unified Diff: chrome/browser/resources/options/chromeos/proxy_options.js

Issue 8102019: redesign and reimplement proxy config service and tracker, revise proxy ui on cros (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/chromeos/proxy.html ('k') | chrome/browser/resources/options/options.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/chromeos/proxy_options.js
===================================================================
--- chrome/browser/resources/options/chromeos/proxy_options.js (revision 103881)
+++ chrome/browser/resources/options/chromeos/proxy_options.js (working copy)
@@ -43,7 +43,7 @@
* Initializes ProxyOptions page.
*/
initializePage: function() {
- // Call base class implementation to starts preference initialization.
+ // Call base class implementation to start preference initialization.
OptionsPage.prototype.initializePage.call(this);
// Set up ignored page.
@@ -63,21 +63,22 @@
observePrefsUI($('proxyAllProtocols'));
},
- proxyListInitalized_: false,
+ proxyListInitialized_: false,
/**
* Update controls state.
* @public
*/
updateControls: function() {
+ this.updateBannerVisibility_();
this.toggleSingle_();
if ($('manualProxy').checked) {
this.enableManual_();
} else {
this.disableManual_();
}
- if (!this.proxyListInitalized_ && this.visible) {
- this.proxyListInitalized_ = true;
+ if (!this.proxyListInitialized_ && this.visible) {
+ this.proxyListInitialized_ = true;
$('ignoredHostList').redraw();
}
},
@@ -92,6 +93,42 @@
},
/**
+ * Updates info banner visibility state. This function shows the banner
+ * if proxy is managed or shared-proxies is off for shared network.
+ * @private
+ */
+ updateBannerVisibility_: function() {
+ var bannerDiv = $('info-banner');
+ var controlledBy = $('directProxy').controlledBy;
+ var clickable = false;
+ if (controlledBy == '') {
+ bannerDiv.hidden = true;
+ } else {
+ bannerDiv.hidden = false;
+ $('banner-text').textContent =
+ localStrings.getString(controlledBy);
xiyuan 2011/10/04 20:28:25 Let's put some comments here that controlledBy mus
kuan 2011/10/04 21:45:50 Done.
+ clickable = controlledBy == "enableSharedProxiesBannerText";
+ }
+ if (clickable) {
+ bannerDiv.classList.add("clickable");
+ bannerDiv.addEventListener('click', this.handleSharedProxiesHint_);
+ } else {
+ bannerDiv.classList.remove("clickable");
+ bannerDiv.removeEventListener('click', this.handleSharedProxiesHint_);
xiyuan 2011/10/04 20:28:25 Let's do this block before we add class/event list
kuan 2011/10/04 21:45:50 Done.
+ }
+ },
+
+ /**
+ * Handler for "click" event on yellow banner with enable-shared-proxies
+ * hint.
+ * @private
+ * @param {Event} e Click event fired from info-banner.
+ */
+ handleSharedProxiesHint_: function(e) {
+ OptionsPage.navigateToPage("internet");
+ },
+
+ /**
* Handler for when the user clicks on the checkbox to allow a
* single proxy usage.
* @private
@@ -114,6 +151,7 @@
* @param {Event} e Click event.
*/
disableManual_: function(e) {
+ $('advancedConfig').style.display = 'none';
xiyuan 2011/10/04 20:28:25 nit: $('advancedConfig').hidden = true;
kuan 2011/10/04 21:45:50 Done.
$('proxyAllProtocols').disabled = true;
$('proxyHostName').disabled = true;
$('proxyHostPort').disabled = true;
@@ -125,11 +163,8 @@
$('ftpProxyPort').disabled = true;
$('socksHost').disabled = true;
$('socksPort').disabled = true;
- $('newHost').disabled = true;
- $('removeHost').disabled = true;
- $('addHost').disabled = true;
- $('advancedConfig').style.display = 'none';
- $('proxyConfig').disabled = !$('autoProxy').checked;
+ $('proxyConfig').disabled = $('autoProxy').disabled ||
+ !$('autoProxy').checked;
},
/**
@@ -139,22 +174,23 @@
* @param {Event} e Click event.
*/
enableManual_: function(e) {
- $('proxyAllProtocols').disabled = false;
- $('proxyHostName').disabled = false;
- $('proxyHostPort').disabled = false;
- $('proxyHostSingleName').disabled = false;
- $('proxyHostSinglePort').disabled = false;
- $('secureProxyHostName').disabled = false;
- $('secureProxyPort').disabled = false;
- $('ftpProxy').disabled = false;
- $('ftpProxyPort').disabled = false;
- $('socksHost').disabled = false;
- $('socksPort').disabled = false;
- $('newHost').disabled = false;
- $('removeHost').disabled = false;
- $('addHost').disabled = false;
$('advancedConfig').style.display = '-webkit-box';
xiyuan 2011/10/04 20:28:25 nit: $('advancedConfig').hidden = false;
kuan 2011/10/04 21:45:50 Done.
$('ignoredHostList').redraw();
+ var all_disabled = $('manualProxy').disabled;
+ $('newHost').disabled = all_disabled;
+ $('removeHost').disabled = all_disabled;
+ $('addHost').disabled = all_disabled;
+ $('proxyAllProtocols').disabled = all_disabled;
+ $('proxyHostName').disabled = all_disabled;
+ $('proxyHostPort').disabled = all_disabled;
+ $('proxyHostSingleName').disabled = all_disabled;
+ $('proxyHostSinglePort').disabled = all_disabled;
+ $('secureProxyHostName').disabled = all_disabled;
+ $('secureProxyPort').disabled = all_disabled;
+ $('ftpProxy').disabled = all_disabled;
+ $('ftpProxyPort').disabled = all_disabled;
+ $('socksHost').disabled = all_disabled;
+ $('socksPort').disabled = all_disabled;
$('proxyConfig').disabled = true;
},
« no previous file with comments | « chrome/browser/resources/options/chromeos/proxy.html ('k') | chrome/browser/resources/options/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698