diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-31 01:34:20 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-31 01:34:20 +0000 |
commit | 41b2780f0135d23196958816d3adcfd606b80f1e (patch) | |
tree | 306a00be7404dfc6d3ff9ef667d35827f87281a2 /chrome/plugin/plugin_thread.cc | |
parent | 18a12354e6c3e1edf2f85e11cd7359127d2d3ce2 (diff) | |
download | chromium_src-41b2780f0135d23196958816d3adcfd606b80f1e.zip chromium_src-41b2780f0135d23196958816d3adcfd606b80f1e.tar.gz chromium_src-41b2780f0135d23196958816d3adcfd606b80f1e.tar.bz2 |
Move proxy resolve requests out of plugin/renderer process, and into the browser.
Review URL: http://codereview.chromium.org/14142
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/plugin_thread.cc')
-rw-r--r-- | chrome/plugin/plugin_thread.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc index d08d5e7..d37edf4 100644 --- a/chrome/plugin/plugin_thread.cc +++ b/chrome/plugin/plugin_thread.cc @@ -14,6 +14,7 @@ #include "chrome/plugin/chrome_plugin_host.h" #include "chrome/plugin/npobject_util.h" #include "chrome/plugin/plugin_process.h" +#include "net/base/net_errors.h" #include "webkit/glue/plugins/plugin_lib.h" #include "webkit/glue/webkit_glue.h" @@ -189,5 +190,36 @@ bool IsDefaultPluginEnabled() { return true; } +static int ResolveProxyFromPluginThread(const GURL& url, + std::string* proxy_result) { + int net_error; + bool ipc_ok = PluginThread::GetPluginThread()->Send( + new PluginProcessHostMsg_ResolveProxy(url, &net_error, proxy_result)); + return ipc_ok ? net_error : net::ERR_UNEXPECTED; +} + +extern int ResolveProxyFromRenderThread(const GURL&, std::string*); +// Dispatch the resolve proxy resquest to the right code, depending on which +// process the plugin is running in {renderer, browser, plugin}. +// +// TODO(eroman): Find a better place to put this; plugin_thread.cc isn't really +// correct since this depends on the renderer thread. One solution is to save +// the function pointers into a table during initialization. +bool FindProxyForUrl(const GURL& url, std::string* proxy_list) { + int net_error; + std::string proxy_result; + + if (PluginThread::GetPluginThread()) + net_error = ResolveProxyFromPluginThread(url, &proxy_result); + else + net_error = ResolveProxyFromRenderThread(url, &proxy_result); + + if (net_error == net::OK) { + *proxy_list = proxy_result; + return true; // Success. + } + return false; // Fail. +} + } // namespace webkit_glue |