Commit 88efee42 authored by gspencer@chromium.org's avatar gspencer@chromium.org

Fix proxy settings so that a port number in the host field gets applied to the port field.

chrome/browser/chromeos/proxy_cros_settings_parser.cc:85 The port
number's final value comes from either the one specified in the Host
field or the one specified in the Port field.  Which one it would be
depends on which field is the last updated field, so the
overriding-it-whatever logic will be no longer necessary, and we
removed it.

chrome/browser/resources/options/chromeos/internet_detail.js:524 Add a
new function called "updateProxySetting", it is used to update the
proxy setting dialog's UI.  Whenever the internal data storing the
proxy information is changed, this function is called to update the UI
instantly.

chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc:167
When the proxy data settings changed, make sure the view is updated
properly by calling JS function - updateProxySettings.

This patch was contributed by keenepan@linpus.com, and originally
reviewed in CL 

TBR=pastarmovj@chromium.org
BUG=chromium-os:26554
TEST=Setting manual proxy with "http://" prefix AND ":<port>" suffix, the proxy settings dialog UI will update and values will in right TEXTVIEW


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175213 0039d316-1c4b-4281-b951-d872f2087c98
parent 3cd0756d
......@@ -214,3 +214,4 @@ Timo Reimann <ttr314@googlemail.com>
Sungguk Lim <limasdf@gmail.com>
Martin Bednorz <m.s.bednorz@gmail.com>
Kamil Jiwa <kamil.jiwa@gmail.com>
Keene Pan <keenepan@linpus.com>
......@@ -82,10 +82,7 @@ net::ProxyServer CreateProxyServer(std::string host,
host_port_pair = net::HostPortPair::FromString(host);
if (host_port_pair.host().empty()) // Host is not URL or <server>::<port>.
host_port_pair = net::HostPortPair(host, port);
// Formal parameter port overrides what may have been specified in host.
if (port != 0 && port != default_port)
host_port_pair.set_port(port);
else if (host_port_pair.port() == 0) // No port in host, use default.
if (host_port_pair.port() == 0) // No port in host, use default.
host_port_pair.set_port(default_port);
return net::ProxyServer(scheme, host_port_pair);
}
......
......@@ -522,6 +522,39 @@ cr.define('options.internet', function() {
detailsPage.visible = true;
};
DetailsInternetPage.updateProxySettings = function(type) {
var proxyHost = null,
proxyPort = null;
if (type == 'cros.session.proxy.singlehttp') {
proxyHost = 'proxy-host-signal-name';
proxyPort = 'proxy-host-single-port';
}else if (type == 'cros.session.proxy.httpurl') {
proxyHost = 'proxy-host-name';
proxyPort = 'proxy-host-port';
}else if (type == 'cros.session.proxy.httpsurl') {
proxyHost = 'secure-proxy-host-name';
proxyPort = 'secure-proxy-port';
}else if (type == 'cros.session.proxy.ftpurl') {
proxyHost = 'ftp-proxy';
proxyPort = 'ftp-proxy-port';
}else if (type == 'cros.session.proxy.socks') {
proxyHost = 'socks-host';
proxyPort = 'socks-port';
}else {
return;
}
var hostValue = $(proxyHost).value;
if (hostValue.indexOf(':') !== -1) {
if (hostValue.match(/:/g).length == 1) {
hostValue = hostValue.split(':');
$(proxyHost).value = hostValue[0];
$(proxyPort).value = hostValue[1];
}
}
};
DetailsInternetPage.updateCarrier = function(carrier) {
DetailsInternetPage.showCarrierChangeSpinner(false);
};
......
......@@ -168,6 +168,10 @@ void CoreChromeOSOptionsHandler::SetPref(const std::string& pref_name,
if (proxy_cros_settings_parser::IsProxyPref(pref_name)) {
proxy_cros_settings_parser::SetProxyPrefValue(Profile::FromWebUI(web_ui()),
pref_name, value);
base::StringValue proxy_type(pref_name);
web_ui()->CallJavascriptFunction(
"options.internet.DetailsInternetPage.updateProxySettings",
proxy_type);
ProcessUserMetric(value, metric);
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment