Index: webkit/glue/plugins/mozilla_extensions.cc |
=================================================================== |
--- webkit/glue/plugins/mozilla_extensions.cc (revision 8931) |
+++ webkit/glue/plugins/mozilla_extensions.cc (working copy) |
@@ -10,8 +10,6 @@ |
#include "base/string_util.h" |
#include "googleurl/src/gurl.h" |
#include "net/base/net_errors.h" |
-#include "net/proxy/proxy_service.h" |
-#include "net/proxy/proxy_resolver_winhttp.h" |
#include "third_party/npapi/bindings/npapi.h" |
#include "webkit/glue/webkit_glue.h" |
#include "webkit/glue/plugins/plugin_instance.h" |
@@ -35,58 +33,12 @@ |
bool MozillaExtensionApi::FindProxyForUrl(const char* url, |
std::string* proxy) { |
- bool result = false; |
- |
if ((!url) || (!proxy)) { |
NOTREACHED(); |
- return result; |
+ return false; |
} |
- scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::Create(NULL)); |
- if (!proxy_service.get()) { |
- NOTREACHED(); |
- return result; |
- } |
- |
- net::ProxyInfo proxy_info; |
- if (proxy_service->ResolveProxy(GURL(std::string(url)), |
- &proxy_info, |
- NULL, |
- NULL) == net::OK) { |
- if (!proxy_info.is_direct()) { |
- std::string winhttp_proxy = proxy_info.proxy_server(); |
- |
- // Winhttp returns proxy in the the following format: |
- // - HTTP proxy: "111.111.111.111:11" |
- // -.SOCKS proxy: "socks=111.111.111.111:11" |
- // - Mixed proxy: "http=111.111.111.111:11; socks=222.222.222.222:22" |
- // |
- // We need to translate this into the following format: |
- // i) "DIRECT" -- no proxy |
- // ii) "PROXY xxx.xxx.xxx.xxx" -- use proxy |
- // iii) "SOCKS xxx.xxx.xxx.xxx" -- use SOCKS |
- // iv) Mixed. e.g. "PROXY 111.111.111.111;PROXY 112.112.112.112", |
- // "PROXY 111.111.111.111;SOCKS 112.112.112.112".... |
- StringToLowerASCII(winhttp_proxy); |
- if (std::string::npos == winhttp_proxy.find('=')) { |
- // Proxy is in the form: "111.111.111.111:11" |
- winhttp_proxy.insert(0, "http "); |
- } else { |
- // Proxy is in the following form. |
- // -.SOCKS proxy: "socks=111.111.111.111:11" |
- // - Mixed proxy: "http=111.111.111.111:11; socks=222.222.222.222:22" |
- // in this case just replace the '=' with a space |
- std::replace_if(winhttp_proxy.begin(), |
- winhttp_proxy.end(), |
- std::bind2nd(std::equal_to<char>(), '='), ' '); |
- } |
- |
- *proxy = winhttp_proxy; |
- result = true; |
- } |
- } |
- |
- return result; |
+ return webkit_glue::FindProxyForUrl(GURL(std::string(url)), proxy); |
} |
// nsISupports implementation |