summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 21:30:12 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 21:30:12 +0000
commit0cf95dfb52f6492f4601891028a3871f817457c7 (patch)
tree8016e3440924e802a099f3f4627dfc1a82c7b816 /chrome
parent1d447cc35c56c2972e5b4cd661d3749b162c6951 (diff)
downloadchromium_src-0cf95dfb52f6492f4601891028a3871f817457c7.zip
chromium_src-0cf95dfb52f6492f4601891028a3871f817457c7.tar.gz
chromium_src-0cf95dfb52f6492f4601891028a3871f817457c7.tar.bz2
Stop using the Profile::Deprecated::GetDefaultRequestContext function in the ChromePluginMessageFilter.
This functionality is currently being used the NPAPI plugin installer on Windows. Fix is to use the request context from the BrowserContext object from the RenderProcessHost instance corresponding to the plugin instance. To retrieve the RenderProcessHost instance we pass the renderer process id from the plugin while initiating the download. Fixes bug http://code.google.com/p/chromium/issues/detail?id=97743 BUG=97743 TEST=no change in functionality. Review URL: http://codereview.chromium.org/8016009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102581 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chrome_plugin_message_filter.cc26
-rw-r--r--chrome/browser/chrome_plugin_message_filter.h18
-rw-r--r--chrome/common/chrome_plugin_messages.h7
-rw-r--r--chrome/default_plugin/plugin_impl_win.cc2
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(),