diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-15 22:19:48 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-15 22:19:48 +0000 |
commit | 8e2b6472071f38c065a3d00adb136ef259ef68a1 (patch) | |
tree | 8a05864f6463e4948c6468139998a59eb6b54899 /chrome/browser/plugin_process_host.cc | |
parent | 10a4a0aa5e9a1754752454ee2d4d8aff872a61a3 (diff) | |
download | chromium_src-8e2b6472071f38c065a3d00adb136ef259ef68a1.zip chromium_src-8e2b6472071f38c065a3d00adb136ef259ef68a1.tar.gz chromium_src-8e2b6472071f38c065a3d00adb136ef259ef68a1.tar.bz2 |
Create a ResourceMessageFilter to filter resource related IPCs. This gets rid of the awkward ResourceDispatcherHost::Receiver interface and allows a bunch of cleanup. I've also generalized the filtering done in WorkerProcessHost and moved it to ChildProcessHost (since it's now used to add the ResourceMessageFilter).
Review URL: http://codereview.chromium.org/5874002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_process_host.cc')
-rw-r--r-- | chrome/browser/plugin_process_host.cc | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index eef30ad..0e7735a 100644 --- a/chrome/browser/plugin_process_host.cc +++ b/chrome/browser/plugin_process_host.cc @@ -28,6 +28,7 @@ #include "chrome/browser/plugin_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" +#include "chrome/browser/renderer_host/resource_message_filter.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/chrome_switches.h" @@ -55,6 +56,25 @@ static const char kDefaultPluginFinderURL[] = "https://dl-ssl.google.com/edgedl/chrome/plugins/plugins2.xml"; +namespace { + +// Helper class that we pass to ResourceMessageFilter so that it can find the +// right URLRequestContext for a request. +class PluginURLRequestContextOverride + : public ResourceMessageFilter::URLRequestContextOverride { + public: + PluginURLRequestContextOverride() { + } + + virtual URLRequestContext* GetRequestContext( + uint32 request_id, ResourceType::Type resource_type) { + return CPBrowsingContextManager::GetInstance()->ToURLRequestContext( + request_id); + } +}; + +} // namespace + #if defined(OS_WIN) void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) { // The window is destroyed at this point, we just care about its parent, which @@ -94,7 +114,8 @@ void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, PluginProcessHost::PluginProcessHost() : BrowserChildProcessHost( PLUGIN_PROCESS, - PluginService::GetInstance()->resource_dispatcher_host()), + PluginService::GetInstance()->resource_dispatcher_host(), + new PluginURLRequestContextOverride()), ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)) #if defined(OS_MACOSX) , plugin_cursor_visible_(true) @@ -399,13 +420,6 @@ void PluginProcessHost::OnResolveProxyCompleted(IPC::Message* reply_msg, Send(reply_msg); } -URLRequestContext* PluginProcessHost::GetRequestContext( - uint32 request_id, - const ViewHostMsg_Resource_Request& request_data) { - return CPBrowsingContextManager::GetInstance()->ToURLRequestContext( - request_id); -} - void PluginProcessHost::RequestPluginChannel(Client* client) { // We can't send any sync messages from the browser because it might lead to // a hang. However this async messages must be answered right away by the |