Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: webkit/glue/plugins/mozilla_extensions.cc

Issue 14142: Start using the proxy resolve IPC for plugins.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | webkit/glue/webkit_glue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | webkit/glue/webkit_glue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698