summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_service.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-24 00:20:48 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-24 00:20:48 +0000
commited4ed0fa4e964e416cd3ac65df64bc238f65461c (patch)
tree83a492355815043301313a6cced9fb96a033c37f /net/proxy/proxy_service.cc
parentb07408332337cd6f10b31e87cbed0886e872fa93 (diff)
downloadchromium_src-ed4ed0fa4e964e416cd3ac65df64bc238f65461c.zip
chromium_src-ed4ed0fa4e964e416cd3ac65df64bc238f65461c.tar.gz
chromium_src-ed4ed0fa4e964e416cd3ac65df64bc238f65461c.tar.bz2
ProxyConfig behaved like a struct, but was defined as a class.
Changed it to be a proper class with hidden implementation variables, setters etc. Also seized this opportunity to move the bypass list from being a member of ProxyConfig, to being a member of ProxyRules. This is a more correct hiearchy, since the bypass rules only apply to the manual settings. Lastly, this makes it possible to have the manual rules evaluation be a method on ProxyRules, and shift some more code out of proxy_service. Review URL: http://codereview.chromium.org/651070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_service.cc')
-rw-r--r--net/proxy/proxy_service.cc41
1 files changed, 2 insertions, 39 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index fa7ba4d..1ff2999 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -319,48 +319,11 @@ int ProxyService::TryToCompleteSynchronously(const GURL& url,
return ERR_IO_PENDING;
}
- if (!config_.proxy_rules.empty()) {
- ApplyProxyRules(url, config_.proxy_rules, result);
- return OK;
- }
-
- // otherwise, we have no proxy config
- result->UseDirect();
+ // Use the manual proxy settings.
+ config_.proxy_rules().Apply(url, result);
return OK;
}
-void ProxyService::ApplyProxyRules(const GURL& url,
- const ProxyConfig::ProxyRules& proxy_rules,
- ProxyInfo* result) {
- DCHECK(!proxy_rules.empty());
-
- if (config_.bypass_rules.Matches(url)) {
- result->UseDirect();
- return;
- }
-
- switch (proxy_rules.type) {
- case ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY:
- result->UseProxyServer(proxy_rules.single_proxy);
- break;
- case ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME: {
- const ProxyServer* entry = proxy_rules.MapUrlSchemeToProxy(url.scheme());
- if (entry) {
- result->UseProxyServer(*entry);
- } else {
- // We failed to find a matching proxy server for the current URL
- // scheme. Default to direct.
- result->UseDirect();
- }
- break;
- }
- default:
- result->UseDirect();
- NOTREACHED();
- break;
- }
-}
-
ProxyService::~ProxyService() {
// Unregister to receive network change notifications.
if (network_change_notifier_)