summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-15 17:16:55 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-15 17:16:55 +0000
commitf6b224d1e92a0986adf6fb3bdaebef1c606147e1 (patch)
tree051d106c0d20fdeba08e3d5f482d538b035589c7 /content/browser
parent79a90d230d67c14292d1807dca6938c11de9275d (diff)
downloadchromium_src-f6b224d1e92a0986adf6fb3bdaebef1c606147e1.zip
chromium_src-f6b224d1e92a0986adf6fb3bdaebef1c606147e1.tar.gz
chromium_src-f6b224d1e92a0986adf6fb3bdaebef1c606147e1.tar.bz2
Simplify ResolveProxyMsgHelper. Make it not special case renderer/plugin, and derive from BrowserMessageFilter for easier filtering and replying.
Review URL: http://codereview.chromium.org/6695009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/plugin_process_host.cc21
-rw-r--r--content/browser/plugin_process_host.h16
-rw-r--r--content/browser/renderer_host/render_message_filter.cc15
-rw-r--r--content/browser/renderer_host/render_message_filter.h13
4 files changed, 6 insertions, 59 deletions
diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc
index 73b2f4a..c398d56 100644
--- a/content/browser/plugin_process_host.cc
+++ b/content/browser/plugin_process_host.cc
@@ -21,6 +21,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/net/resolve_proxy_msg_helper.h"
#include "chrome/browser/net/url_request_tracking.h"
#include "chrome/browser/plugin_download_helper.h"
#include "chrome/browser/profiles/profile.h"
@@ -95,8 +96,7 @@ void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id,
PluginProcessHost::PluginProcessHost()
: BrowserChildProcessHost(
PLUGIN_PROCESS,
- PluginService::GetInstance()->resource_dispatcher_host()),
- ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL))
+ PluginService::GetInstance()->resource_dispatcher_host())
#if defined(OS_MACOSX)
, plugin_cursor_visible_(true)
#endif
@@ -245,6 +245,8 @@ bool PluginProcessHost::Init(const webkit::npapi::WebPluginInfo& info,
#endif
cmd_line);
+ AddFilter(new ResolveProxyMsgHelper(NULL));
+
return true;
}
@@ -260,8 +262,6 @@ bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated)
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl,
OnGetPluginFinderUrl)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy,
- OnResolveProxy)
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed,
OnPluginWindowDestroyed)
@@ -330,19 +330,6 @@ void PluginProcessHost::OpenChannelToPlugin(Client* client) {
RequestPluginChannel(client);
}
-void PluginProcessHost::OnResolveProxy(const GURL& url,
- IPC::Message* reply_msg) {
- resolve_proxy_msg_helper_.Start(url, reply_msg);
-}
-
-void PluginProcessHost::OnResolveProxyCompleted(IPC::Message* reply_msg,
- int result,
- const std::string& proxy_list) {
- PluginProcessHostMsg_ResolveProxy::WriteReplyParams(
- reply_msg, result, proxy_list);
- Send(reply_msg);
-}
-
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
diff --git a/content/browser/plugin_process_host.h b/content/browser/plugin_process_host.h
index 14d1a6f..a7be1c3 100644
--- a/content/browser/plugin_process_host.h
+++ b/content/browser/plugin_process_host.h
@@ -15,7 +15,6 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
-#include "chrome/browser/net/resolve_proxy_msg_helper.h"
#include "content/browser/browser_child_process_host.h"
#include "ui/gfx/native_widget_types.h"
#include "webkit/plugins/npapi/webplugininfo.h"
@@ -38,8 +37,7 @@ class GURL;
// starting the plugin process when a plugin is created that doesn't already
// have a process. After that, most of the communication is directly between
// the renderer and plugin processes.
-class PluginProcessHost : public BrowserChildProcessHost,
- public ResolveProxyMsgHelper::Delegate {
+class PluginProcessHost : public BrowserChildProcessHost {
public:
class Client {
public:
@@ -70,11 +68,6 @@ class PluginProcessHost : public BrowserChildProcessHost,
virtual void OnChannelConnected(int32 peer_pid);
virtual void OnChannelError();
- // ResolveProxyMsgHelper::Delegate implementation:
- virtual void OnResolveProxyCompleted(IPC::Message* reply_msg,
- int result,
- const std::string& proxy_list);
-
// Tells the plugin process to create a new channel for communication with a
// renderer. When the plugin process responds with the channel name,
// OnChannelOpened in the client is called.
@@ -100,8 +93,6 @@ class PluginProcessHost : public BrowserChildProcessHost,
#endif
private:
- friend class PluginResolveProxyHelper;
-
// Sends a message to the plugin process to request creation of a new channel
// for the given mime type.
void RequestPluginChannel(Client* client);
@@ -109,7 +100,6 @@ class PluginProcessHost : public BrowserChildProcessHost,
// Message handlers.
void OnChannelCreated(const IPC::ChannelHandle& channel_handle);
void OnGetPluginFinderUrl(std::string* plugin_finder_url);
- void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
#if defined(OS_WIN)
void OnPluginWindowDestroyed(HWND window, HWND parent);
@@ -145,10 +135,6 @@ class PluginProcessHost : public BrowserChildProcessHost,
// Information about the plugin.
webkit::npapi::WebPluginInfo info_;
- // Helper class for handling PluginProcessHost_ResolveProxy messages (manages
- // the requests to the proxy service).
- ResolveProxyMsgHelper resolve_proxy_msg_helper_;
-
#if defined(OS_WIN)
// Tracks plugin parent windows created on the UI thread.
std::set<HWND> plugin_parent_windows_set_;
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 0a29798..0c5c83a 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -284,7 +284,6 @@ RenderMessageFilter::RenderMessageFilter(
plugin_service_(plugin_service),
profile_(profile),
content_settings_(profile->GetHostContentSettingsMap()),
- ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)),
extensions_request_context_(profile->GetRequestContextForExtensions()),
render_widget_helper_(render_widget_helper),
notification_prefs_(
@@ -372,7 +371,6 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_MESSAGE_HANDLER(ViewHostMsg_ResourceTypeStats, OnResourceTypeStats)
IPC_MESSAGE_HANDLER(ViewHostMsg_V8HeapStats, OnV8HeapStats)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ResolveProxy, OnResolveProxy)
#if defined(OS_MACOSX)
IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB, OnAllocTransportDIB)
IPC_MESSAGE_HANDLER(ViewHostMsg_FreeTransportDIB, OnFreeTransportDIB)
@@ -867,19 +865,6 @@ void RenderMessageFilter::UpdateHostZoomLevelsOnUIThread(
}
}
-void RenderMessageFilter::OnResolveProxy(const GURL& url,
- IPC::Message* reply_msg) {
- resolve_proxy_msg_helper_.Start(url, reply_msg);
-}
-
-void RenderMessageFilter::OnResolveProxyCompleted(
- IPC::Message* reply_msg,
- int result,
- const std::string& proxy_list) {
- ViewHostMsg_ResolveProxy::WriteReplyParams(reply_msg, result, proxy_list);
- Send(reply_msg);
-}
-
ChromeURLRequestContext* RenderMessageFilter::GetRequestContextForURL(
const GURL& url) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h
index 2edcc53..ab6ba38 100644
--- a/content/browser/renderer_host/render_message_filter.h
+++ b/content/browser/renderer_host/render_message_filter.h
@@ -20,7 +20,6 @@
#include "base/string16.h"
#include "base/task.h"
#include "build/build_config.h"
-#include "chrome/browser/net/resolve_proxy_msg_helper.h"
#include "chrome/common/content_settings.h"
#include "content/browser/browser_message_filter.h"
#include "content/browser/in_process_webkit/webkit_context.h"
@@ -56,8 +55,7 @@ class CookieStore;
// This class filters out incoming IPC messages for the renderer process on the
// IPC thread.
-class RenderMessageFilter : public BrowserMessageFilter,
- public ResolveProxyMsgHelper::Delegate {
+class RenderMessageFilter : public BrowserMessageFilter {
public:
// Create the filter.
RenderMessageFilter(int render_process_id,
@@ -215,11 +213,6 @@ class RenderMessageFilter : public BrowserMessageFilter,
void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
- // ResolveProxyMsgHelper::Delegate implementation:
- virtual void OnResolveProxyCompleted(IPC::Message* reply_msg,
- int result,
- const std::string& proxy_list);
-
// Browser side transport DIB allocation
void OnAllocTransportDIB(size_t size,
bool cache_in_browser,
@@ -297,10 +290,6 @@ class RenderMessageFilter : public BrowserMessageFilter,
// access it on other threads.
HostContentSettingsMap* content_settings_;
- // Helper class for handling PluginProcessHost_ResolveProxy messages (manages
- // the requests to the proxy service).
- ResolveProxyMsgHelper resolve_proxy_msg_helper_;
-
// Contextual information to be used for requests created here.
scoped_refptr<URLRequestContextGetter> request_context_;