Commit a1314122 authored by Jon Mann's avatar Jon Mann Committed by Commit Bot

[Wi-Fi Sync] Fix support for manual proxies.

This adds support for customizing seperate values for HTTP, secure
HTTP, and SOCKS proxy hosts and ports.

Bug: 966270
Change-Id: I88e83f2ca7f764e6eb32cd2ed214b392b289a95a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2135310Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Jon Mann <jonmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756395}
parent 2e7bc22b
......@@ -135,14 +135,30 @@ ProxyConfigurationProtoFromMojo(
sync_pb::WifiConfigurationSpecifics_ProxyConfiguration::
PROXY_OPTION_AUTOMATIC) {
if (proxy_settings->pac) {
proto.set_proxy_url(proxy_settings->pac->active_value);
proto.set_autoconfiguration_url(proxy_settings->pac->active_value);
}
} else if (proto.proxy_option() ==
sync_pb::WifiConfigurationSpecifics_ProxyConfiguration::
PROXY_OPTION_MANUAL) {
// TODO: Implement support for manual proxies.
// Return an empty proxy configuration for now.
return sync_pb::WifiConfigurationSpecifics_ProxyConfiguration();
sync_pb::
WifiConfigurationSpecifics_ProxyConfiguration_ManualProxyConfiguration*
manual_settings = proto.mutable_manual_proxy_configuration();
manual_settings->set_http_proxy_url(
proxy_settings->manual->http_proxy->host->active_value);
manual_settings->set_http_proxy_port(
proxy_settings->manual->http_proxy->port->active_value);
manual_settings->set_secure_http_proxy_url(
proxy_settings->manual->secure_http_proxy->host->active_value);
manual_settings->set_secure_http_proxy_port(
proxy_settings->manual->secure_http_proxy->port->active_value);
manual_settings->set_socks_host_url(
proxy_settings->manual->socks->host->active_value);
manual_settings->set_socks_host_port(
proxy_settings->manual->socks->port->active_value);
for (const std::string& domain :
proxy_settings->exclude_domains->active_value) {
manual_settings->add_whitelisted_domains(domain);
}
}
return proto;
......
......@@ -1077,12 +1077,22 @@ VISIT_PROTO_FIELDS(const sync_pb::WebAppSpecifics& proto) {
VISIT(theme_color);
}
VISIT_PROTO_FIELDS(const sync_pb::WifiConfigurationSpecifics::
ProxyConfiguration::ManualProxyConfiguration& proto) {
VISIT(http_proxy_url);
VISIT(http_proxy_port);
VISIT(secure_http_proxy_url);
VISIT(secure_http_proxy_port);
VISIT(socks_host_url);
VISIT(socks_host_port);
VISIT_REP(whitelisted_domains);
}
VISIT_PROTO_FIELDS(
const sync_pb::WifiConfigurationSpecifics::ProxyConfiguration& proto) {
VISIT_ENUM(proxy_option);
VISIT(proxy_url);
VISIT(proxy_port);
VISIT_REP(whitelisted_domains);
VISIT(autoconfiguration_url);
VISIT(manual_proxy_configuration);
}
VISIT_PROTO_FIELDS(const sync_pb::WifiConfigurationSpecifics& proto) {
......
......@@ -60,16 +60,23 @@ message WifiConfigurationSpecifics {
// Uses Web Proxy Auto-Discovery Protocol (WPAD) to discover the proxy
// settings using DHCP/DNS.
PROXY_OPTION_AUTODISCOVERY = 3;
// User sets proxy_url, proxy_port, and whitelisted_domains manually.
// User sets details in manual_proxy_configuration.
PROXY_OPTION_MANUAL = 4;
}
optional ProxyOption proxy_option = 1;
// Only set if PROXY_OPTION_AUTOMATIC or PROXY_OPTION_MANUAL.
optional string proxy_url = 2;
// Only set if PROXY_OPTION_MANUAL.
optional int32 proxy_port = 3;
// Only set if PROXY_OPTION_AUTOMATIC.
optional string autoconfiguration_url = 2;
message ManualProxyConfiguration {
optional string http_proxy_url = 1;
optional int32 http_proxy_port = 2;
optional string secure_http_proxy_url = 3;
optional int32 secure_http_proxy_port = 4;
optional string socks_host_url = 5;
optional int32 socks_host_port = 6;
repeated string whitelisted_domains = 7;
}
// Only set if PROXY_OPTION_MANUAL.
repeated string whitelisted_domains = 4;
optional ManualProxyConfiguration manual_proxy_configuration = 3;
}
optional ProxyConfiguration proxy_configuration = 7;
// List of DNS servers to be used. Up to 4.
......
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