diff options
-rw-r--r-- | chrome/browser/chrome_plugin_message_filter.cc | 26 | ||||
-rw-r--r-- | chrome/browser/chrome_plugin_message_filter.h | 18 | ||||
-rw-r--r-- | chrome/common/chrome_plugin_messages.h | 7 | ||||
-rw-r--r-- | chrome/default_plugin/plugin_impl_win.cc | 2 |
4 files changed, 42 insertions, 11 deletions
diff --git a/chrome/browser/chrome_plugin_message_filter.cc b/chrome/browser/chrome_plugin_message_filter.cc index cf128fb..6e73f6e 100644 --- a/chrome/browser/chrome_plugin_message_filter.cc +++ b/chrome/browser/chrome_plugin_message_filter.cc @@ -14,6 +14,7 @@ #include "chrome/common/chrome_plugin_messages.h" #include "content/browser/browser_thread.h" #include "content/browser/plugin_process_host.h" +#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "net/url_request/url_request_context_getter.h" @@ -51,19 +52,36 @@ bool ChromePluginMessageFilter::Send(IPC::Message* message) { #if defined(OS_WIN) && !defined(USE_AURA) void ChromePluginMessageFilter::OnDownloadUrl(const std::string& url, - gfx::NativeWindow caller_window) { + gfx::NativeWindow caller_window, + int render_process_id) { + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + NewRunnableFunction(OnDownloadUrlOnUIThread, url, caller_window, + render_process_id)); +} + +void ChromePluginMessageFilter::OnDownloadUrlOnUIThread( + const std::string& url, + gfx::NativeWindow caller_window, + int render_process_id) { + RenderProcessHost* host = RenderProcessHost::FromID(render_process_id); + if (!host) { + return; + } BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableFunction(OnDownloadUrlOnFileThread, url, caller_window)); + NewRunnableFunction(OnDownloadUrlOnFileThread, url, caller_window, + host->browser_context()->GetRequestContext())); } void ChromePluginMessageFilter::OnDownloadUrlOnFileThread( const std::string& url, - gfx::NativeWindow caller_window) { + gfx::NativeWindow caller_window, + net::URLRequestContextGetter* context) { PluginDownloadUrlHelper* download_url_helper = new PluginDownloadUrlHelper(url, caller_window, NULL); download_url_helper->InitiateDownload( - Profile::Deprecated::GetDefaultRequestContext(), + context, BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); } diff --git a/chrome/browser/chrome_plugin_message_filter.h b/chrome/browser/chrome_plugin_message_filter.h index 17eb0bc..3243a33 100644 --- a/chrome/browser/chrome_plugin_message_filter.h +++ b/chrome/browser/chrome_plugin_message_filter.h @@ -11,6 +11,10 @@ class PluginProcessHost; +namespace net { +class URLRequestContextGetter; +}; + // This class filters out incoming Chrome-specific IPC messages for the plugin // process on the IPC thread. class ChromePluginMessageFilter : public IPC::ChannelProxy::MessageFilter, @@ -29,10 +33,18 @@ class ChromePluginMessageFilter : public IPC::ChannelProxy::MessageFilter, #if defined(OS_WIN) && !defined(USE_AURA) void OnDownloadUrl(const std::string& url, - gfx::NativeWindow caller_window); + gfx::NativeWindow caller_window, + int render_process_id); // Helper function to issue the download request on the file thread. - static void OnDownloadUrlOnFileThread(const std::string& url, - gfx::NativeWindow caller_window); + static void OnDownloadUrlOnFileThread( + const std::string& url, + gfx::NativeWindow caller_window, + net::URLRequestContextGetter* context); + // Helper function to handle the initial portions of the download request + // on the UI thread. + static void OnDownloadUrlOnUIThread(const std::string& url, + gfx::NativeWindow caller_window, + int render_process_id); #endif void OnGetPluginFinderUrl(std::string* plugin_finder_url); void OnMissingPluginStatus(int status, diff --git a/chrome/common/chrome_plugin_messages.h b/chrome/common/chrome_plugin_messages.h index 4335fdc..ff07a4a 100644 --- a/chrome/common/chrome_plugin_messages.h +++ b/chrome/common/chrome_plugin_messages.h @@ -16,7 +16,7 @@ //----------------------------------------------------------------------------- // ChromePluginHost messages -// These are messages sent from the plugin process to the renderer process. +// These are messages sent from the plugin process to the browser process. // Used to retrieve the plugin finder URL. IPC_SYNC_MESSAGE_CONTROL0_1(ChromePluginProcessHostMsg_GetPluginFinderUrl, @@ -33,8 +33,9 @@ IPC_MESSAGE_CONTROL4(ChromePluginProcessHostMsg_MissingPluginStatus, #if defined(OS_WIN) // Used to initiate a download on the plugin installer file from the URL // passed in. -IPC_MESSAGE_CONTROL2(ChromePluginProcessHostMsg_DownloadUrl, +IPC_MESSAGE_CONTROL3(ChromePluginProcessHostMsg_DownloadUrl, std::string /* URL */, - gfx::NativeWindow /* caller window */) + gfx::NativeWindow /* caller window */, + int /* render_process_id */) #endif // OS_WIN diff --git a/chrome/default_plugin/plugin_impl_win.cc b/chrome/default_plugin/plugin_impl_win.cc index 22f6aa4..d61228b 100644 --- a/chrome/default_plugin/plugin_impl_win.cc +++ b/chrome/default_plugin/plugin_impl_win.cc @@ -348,7 +348,7 @@ void PluginInstallerImpl::DownloadPlugin() { if (!plugin_download_url_for_display_) { #if !defined(USE_AURA) ChildThread::current()->Send(new ChromePluginProcessHostMsg_DownloadUrl( - plugin_download_url_, hwnd())); + plugin_download_url_, hwnd(), renderer_process_id())); #endif } else { default_plugin::g_browser->geturl(instance(), |