Skip to content

Commit

Permalink
Added "Use an autoconfiguration URL" checkbox in proxy tab
Browse files Browse the repository at this point in the history
    
    Adding this checkbox makes user to be aware of auto detecting proxy
    option and also meets the new design suggested to solve the same.
    Providing this checkbox also ease the user to select between auto
    configuring proxy(PAC) and auto detecting proxy(WPAD). This
    checkbox functions similar to the one already provided to select
    single proxy mode.
    
    Contributed by sathish.kuppuswamy@intel.com
    
    BUG=chromium:222576
    TEST=Built the changes along with Chromium OS, verified the
         behaviour of the checkbox and proxy connection. Selected
         "Automatic proxy configuration" option
         1, Verified internet access after checking "use a
         autoconfiguration URL" checkbox and entering a valid PAC
         URL in the URL field(Auto configuring proxy).
         2, Verified internet access, leaving "use a autoconfiguration
         URL" unchecked(Auto Detecting proxy). Same is been verified by
         checking "use a autoconfiguration URL" checkbox, but leaving
         the URL field blank.

Review URL: https://chromiumcodereview.appspot.com/13334007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195690 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sathish.kuppuswamy@intel.com committed Apr 23, 2013
1 parent 2462b7f commit 1a315eb
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 8 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,4 @@ Yoshinori Sano <yoshinori.sano@gmail.com>
Mrunal Kapade <mrunal.kapade@intel.com>
Yael Aharon <yael.aharon@intel.com>
Haojian Wu <hokein.wu@gmail.com>
Sathish Kuppuswamy <sathish.kuppuswamy@intel.com>
4 changes: 2 additions & 2 deletions chrome/app/chromeos_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -2366,8 +2366,8 @@ Battery full
<message name="IDS_PROXY_AUTOMATIC" desc="Radio to select configuring from a URL.">
Automatic proxy configuration
</message>
<message name="IDS_PROXY_CONFIG_URL" desc="Label for the proxy config URL box.">
Autoconfiguration URL
<message name="IDS_PROXY_USE_AUTOCONFIG_URL" desc="Label for the checkbox that controls whether to use an autoconfiguration URL.">
Use an autoconfiguration URL
</message>
<message name="IDS_PROXY_ADVANCED_CONFIG" desc="Label for the Advanced Proxy.">
Advanced Configuration
Expand Down
15 changes: 15 additions & 0 deletions chrome/browser/chromeos/proxy_cros_settings_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const char kProxyFtpPort[] = "cros.session.proxy.ftpport";
const char kProxySocks[] = "cros.session.proxy.socks";
const char kProxySocksPort[] = "cros.session.proxy.socksport";
const char kProxyIgnoreList[] = "cros.session.proxy.ignorelist";
const char kProxyUsePacUrl[] = "cros.session.proxy.usepacurl";

const char* const kProxySettings[] = {
kProxyPacUrl,
Expand All @@ -45,6 +46,7 @@ const char* const kProxySettings[] = {
kProxySocks,
kProxySocksPort,
kProxyIgnoreList,
kProxyUsePacUrl,
};

// We have to explicitly export this because the arraysize macro doesn't like
Expand Down Expand Up @@ -232,6 +234,16 @@ void SetProxyPrefValue(Profile* profile,
config_service->UISetProxyConfigToProxyPerScheme("http",
config.http_proxy.server);
}
} else if (path == kProxyUsePacUrl) {
bool use_pac_url;
if (in_value->GetAsBoolean(&use_pac_url)) {
if (use_pac_url && config.automatic_proxy.pac_url.is_valid()) {
config_service->UISetProxyConfigToPACScript(
config.automatic_proxy.pac_url);
} else {
config_service->UISetProxyConfigToAutoDetect();
}
}
} else if (path == kProxyFtpUrl) {
std::string val;
if (in_value->GetAsString(&val)) {
Expand Down Expand Up @@ -337,6 +349,9 @@ bool GetProxyPrefValue(Profile* profile,
} else if (path == kProxySingle) {
data = base::Value::CreateBooleanValue(config.mode ==
chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_SINGLE_PROXY);
} else if (path == kProxyUsePacUrl) {
data = base::Value::CreateBooleanValue(config.mode ==
chromeos::ProxyConfigServiceImpl::ProxyConfig::MODE_PAC_SCRIPT);
} else if (path == kProxyFtpUrl) {
data = CreateServerHostValue(config.ftp_proxy);
} else if (path == kProxySocks) {
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/chromeos/proxy_cros_settings_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern const char kProxyFtpPort[];
extern const char kProxySocks[];
extern const char kProxySocksPort[];
extern const char kProxyIgnoreList[];
extern const char kProxyUsePacUrl[];

extern const char* const kProxySettings[];
extern const size_t kProxySettingsCount;
Expand Down
10 changes: 8 additions & 2 deletions chrome/browser/resources/options/chromeos/internet_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,16 @@
<span i18n-content="proxyAutomatic"></span>
</label>
</div>
<div class="checkbox">
<label>
<input id="proxy-use-pac-url" type="checkbox"
pref="cros.session.proxy.usepacurl">
<span i18n-content="proxyUseConfigUrl"></span>
</label>
</div>
<div>
<label>
<div i18n-content="proxyConfigUrl"></div>
<input id="proxy-config" type="url" size="50"
<input id="proxy-pac-url" type="url" size="50"
pref="cros.session.proxy.pacurl">
</label>
</div>
Expand Down
22 changes: 19 additions & 3 deletions chrome/browser/resources/options/chromeos/internet_detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,14 @@ cr.define('options.internet', function() {
$('auto-proxy').addEventListener('click', this.disableManualProxy_);
$('proxy-all-protocols').addEventListener('click',
this.toggleSingleProxy_);
$('proxy-use-pac-url').addEventListener('change',
this.handleAutoConfigProxy_);

observePrefsUI($('direct-proxy'));
observePrefsUI($('manual-proxy'));
observePrefsUI($('auto-proxy'));
observePrefsUI($('proxy-all-protocols'));
observePrefsUI($('proxy-use-pac-url'));

$('ip-automatic-configuration-checkbox').addEventListener('click',
this.handleIpAutoConfig_);
Expand Down Expand Up @@ -429,6 +432,16 @@ cr.define('options.internet', function() {
}
},

/**
* Handler for when the user clicks on the checkbox to enter
* auto configuration URL.
* @private
* @param {Event} e Click Event.
*/
handleAutoConfigProxy_: function(e) {
$('proxy-pac-url').disabled = !$('proxy-use-pac-url').checked;
},

/**
* Handler for selecting a radio button that will disable the manual
* controls.
Expand All @@ -448,8 +461,10 @@ cr.define('options.internet', function() {
$('ftp-proxy-port').disabled = true;
$('socks-host').disabled = true;
$('socks-port').disabled = true;
$('proxy-config').disabled = $('auto-proxy').disabled ||
!$('auto-proxy').checked;
$('proxy-use-pac-url').disabled = $('auto-proxy').disabled ||
!$('auto-proxy').checked;
$('proxy-pac-url').disabled = $('proxy-use-pac-url').disabled ||
!$('proxy-use-pac-url').checked;
},

/**
Expand All @@ -476,7 +491,8 @@ cr.define('options.internet', function() {
$('ftp-proxy-port').disabled = allDisabled;
$('socks-host').disabled = allDisabled;
$('socks-port').disabled = allDisabled;
$('proxy-config').disabled = true;
$('proxy-use-pac-url').disabled = true;
$('proxy-pac-url').disabled = true;
},
};

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/webui/options/chromeos/proxy_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void ProxyHandler::GetLocalizedValues(
{ "ftpProxy", IDS_PROXY_FTP_PROXY },
{ "socksHost", IDS_PROXY_SOCKS_HOST },
{ "proxyAutomatic", IDS_PROXY_AUTOMATIC },
{ "proxyConfigUrl", IDS_PROXY_CONFIG_URL },
{ "proxyUseConfigUrl", IDS_PROXY_USE_AUTOCONFIG_URL },
{ "advancedProxyConfig", IDS_PROXY_ADVANCED_CONFIG },
{ "addHost", IDS_PROXY_ADD_HOST },
{ "removeHost", IDS_PROXY_REMOVE_HOST },
Expand Down

0 comments on commit 1a315eb

Please sign in to comment.