summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_shutdown.cc1
-rw-r--r--chrome/browser/net/resolve_proxy_msg_helper.cc28
-rw-r--r--chrome/browser/net/resolve_proxy_msg_helper.h52
-rw-r--r--chrome/browser/net/resolve_proxy_msg_helper_unittest.cc230
-rw-r--r--chrome/browser/plugin_data_remover.cc1
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc3
-rw-r--r--chrome/common/render_messages.h8
-rw-r--r--chrome/plugin/plugin_thread.cc15
-rw-r--r--chrome/renderer/pepper_plugin_delegate_impl.cc6
9 files changed, 162 insertions, 182 deletions
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index d37a45a..72c7735 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -15,6 +15,7 @@
#include "base/process_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "base/time.h"
diff --git a/chrome/browser/net/resolve_proxy_msg_helper.cc b/chrome/browser/net/resolve_proxy_msg_helper.cc
index 967e529..01cb3bf 100644
--- a/chrome/browser/net/resolve_proxy_msg_helper.cc
+++ b/chrome/browser/net/resolve_proxy_msg_helper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,19 +7,30 @@
#include "base/compiler_specific.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/net/url_request_context_getter.h"
+#include "content/common/child_process_messages.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request_context.h"
-ResolveProxyMsgHelper::ResolveProxyMsgHelper(Delegate* delegate,
- net::ProxyService* proxy_service)
+ResolveProxyMsgHelper::ResolveProxyMsgHelper(net::ProxyService* proxy_service)
: proxy_service_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
this, &ResolveProxyMsgHelper::OnResolveProxyCompleted)),
- delegate_(delegate),
proxy_service_override_(proxy_service) {
}
-void ResolveProxyMsgHelper::Start(const GURL& url, IPC::Message* reply_msg) {
+bool ResolveProxyMsgHelper::OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP_EX(ResolveProxyMsgHelper, message, *message_was_ok)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(ChildProcessHostMsg_ResolveProxy,
+ OnResolveProxy)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void ResolveProxyMsgHelper::OnResolveProxy(const GURL& url,
+ IPC::Message* reply_msg) {
// Enqueue the pending request.
pending_requests_.push_back(PendingRequest(url, reply_msg));
@@ -31,11 +42,10 @@ void ResolveProxyMsgHelper::Start(const GURL& url, IPC::Message* reply_msg) {
void ResolveProxyMsgHelper::OnResolveProxyCompleted(int result) {
CHECK(!pending_requests_.empty());
- // Notify the delegate of completion.
const PendingRequest& completed_req = pending_requests_.front();
- delegate_->OnResolveProxyCompleted(completed_req.reply_msg,
- result,
- proxy_info_.ToPacString());
+ ChildProcessHostMsg_ResolveProxy::WriteReplyParams(
+ completed_req.reply_msg, result, proxy_info_.ToPacString());
+ Send(completed_req.reply_msg);
// Clear the current (completed) request.
pending_requests_.pop_front();
diff --git a/chrome/browser/net/resolve_proxy_msg_helper.h b/chrome/browser/net/resolve_proxy_msg_helper.h
index e596adc..f0f6911 100644
--- a/chrome/browser/net/resolve_proxy_msg_helper.h
+++ b/chrome/browser/net/resolve_proxy_msg_helper.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,55 +10,37 @@
#include <string>
#include "base/ref_counted.h"
+#include "content/browser/browser_message_filter.h"
#include "googleurl/src/gurl.h"
-#include "ipc/ipc_message.h"
#include "net/base/completion_callback.h"
#include "net/proxy/proxy_service.h"
-// This class holds the common logic used to respond to the messages:
-// {PluginProcessHostMsg_ResolveProxy, ViewHostMsg_ResolveProxy}.
-//
-// This involves kicking off a ProxyResolve request on the IO thread using
-// the specified proxy service.
-//
-// When the request completes, it calls the delegate's OnProxyResolveCompleted()
-// method, passing it the result (error code + proxy list), as well as the
-// IPC::Message pointer that had been stored.
+// Responds to ChildProcessHostMsg_ResolveProxy, kicking off a ProxyResolve
+// request on the IO thread using the specified proxy service. Completion is
+// notified through the delegate. If multiple requests are started at the same
+// time, they will run in FIFO order, with only 1 being outstanding at a time.
//
// When an instance of ResolveProxyMsgHelper is destroyed, it cancels any
// outstanding proxy resolve requests with the proxy service. It also deletes
// the stored IPC::Message pointers for pending requests.
//
// This object is expected to live on the IO thread.
-class ResolveProxyMsgHelper {
+class ResolveProxyMsgHelper : public BrowserMessageFilter {
public:
- class Delegate {
- public:
- // Callback for when the proxy resolve request has completed.
- // |reply_msg| -- The same pointer that the request was started with.
- // |result| -- The network error code from ProxyService.
- // |proxy_list| -- The PAC string result from ProxyService.
- virtual void OnResolveProxyCompleted(IPC::Message* reply_msg,
- int result,
- const std::string& proxy_list) = 0;
- virtual ~Delegate() {}
- };
-
- // Constructs a ResolveProxyMsgHelper instance that notifies request
- // completion to |delegate|. Note that |delegate| must be live throughout
- // our lifespan. If |proxy_service| is NULL, then the current profile's
- // proxy service will be used.
- ResolveProxyMsgHelper(Delegate* delegate, net::ProxyService* proxy_service);
-
- // Resolves proxies for |url|. Completion is notified through the delegate.
- // If multiple requests are started at the same time, they will run in
- // FIFO order, with only 1 being outstanding at a time.
- void Start(const GURL& url, IPC::Message* reply_msg);
+ // If |proxy_service| is NULL, then the main profile's proxy service will
+ // be used.
+ explicit ResolveProxyMsgHelper(net::ProxyService* proxy_service);
// Destruction cancels the current outstanding request, and clears the
// pending queue.
~ResolveProxyMsgHelper();
+ // BrowserMessageFilter implementation
+ virtual bool OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok);
+
+ void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
+
private:
// Callback for the ProxyService (bound to |callback_|).
void OnResolveProxyCompleted(int result);
@@ -95,8 +77,6 @@ class ResolveProxyMsgHelper {
typedef std::deque<PendingRequest> PendingRequestList;
PendingRequestList pending_requests_;
- Delegate* delegate_;
-
// Specified by unit-tests, to use this proxy service in place of the
// global one.
scoped_refptr<net::ProxyService> proxy_service_override_;
diff --git a/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc b/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc
index 3bdb695..dffd0cf 100644
--- a/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc
+++ b/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc
@@ -1,9 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/net/resolve_proxy_msg_helper.h"
+#include "content/common/child_process_messages.h"
+#include "ipc/ipc_test_sink.h"
#include "net/base/net_errors.h"
#include "net/proxy/mock_proxy_resolver.h"
#include "net/proxy/proxy_config_service.h"
@@ -20,213 +22,213 @@ class MockProxyConfigService : public net::ProxyConfigService {
}
};
-class MyDelegate : public ResolveProxyMsgHelper::Delegate {
+class ResolveProxyMsgHelperTest : public testing::Test,
+ public IPC::Channel::Listener {
public:
struct PendingResult {
- PendingResult(IPC::Message* msg,
- int error_code,
+ PendingResult(int error_code,
const std::string& proxy_list)
- : msg(msg), error_code(error_code), proxy_list(proxy_list) {
+ : error_code(error_code), proxy_list(proxy_list) {
}
- IPC::Message* msg;
int error_code;
std::string proxy_list;
};
- // ResolveProxyMsgHelper::Delegate implementation:
- virtual void OnResolveProxyCompleted(IPC::Message* reply_msg,
- int error_code,
- const std::string& proxy_list) {
- DCHECK(!pending_result_.get());
- pending_result_.reset(new PendingResult(reply_msg, error_code, proxy_list));
+ ResolveProxyMsgHelperTest()
+ : resolver_(new net::MockAsyncProxyResolver),
+ service_(new net::ProxyService(
+ new MockProxyConfigService, resolver_, NULL)),
+ helper_(new ResolveProxyMsgHelper(service_.get())),
+ message_loop_(MessageLoop::TYPE_IO),
+ io_thread_(BrowserThread::IO, &message_loop_) {
+ test_sink_.AddFilter(this);
+ helper_->OnFilterAdded(&test_sink_);
}
+ protected:
const PendingResult* pending_result() const { return pending_result_.get(); }
void clear_pending_result() {
pending_result_.reset();
}
- private:
+ IPC::Message* GenerateReply() {
+ int temp_int;
+ std::string temp_string;
+ ChildProcessHostMsg_ResolveProxy message(GURL(), &temp_int, &temp_string);
+ return IPC::SyncMessage::GenerateReply(&message);
+ }
+
+ net::MockAsyncProxyResolver* resolver_;
+ scoped_refptr<net::ProxyService> service_;
+ scoped_refptr<ResolveProxyMsgHelper> helper_;
scoped_ptr<PendingResult> pending_result_;
-};
-// Issue three sequential requests -- each should succeed.
-TEST(ResolveProxyMsgHelperTest, Sequential) {
- net::MockAsyncProxyResolver* resolver = new net::MockAsyncProxyResolver;
- scoped_refptr<net::ProxyService> service(
- new net::ProxyService(new MockProxyConfigService, resolver, NULL));
+ private:
+ virtual bool OnMessageReceived(const IPC::Message& msg) {
+ TupleTypes<ChildProcessHostMsg_ResolveProxy::ReplyParam>::ValueTuple
+ reply_data;
+ EXPECT_TRUE(
+ ChildProcessHostMsg_ResolveProxy::ReadReplyParam(&msg, &reply_data));
+ DCHECK(!pending_result_.get());
+ pending_result_.reset(new PendingResult(reply_data.a, reply_data.b));
+ test_sink_.ClearMessages();
+ return true;
+ }
- MyDelegate delegate;
- ResolveProxyMsgHelper helper(&delegate, service);
+ MessageLoop message_loop_;
+ BrowserThread io_thread_;
+ IPC::TestSink test_sink_;
+};
+// Issue three sequential requests -- each should succeed.
+TEST_F(ResolveProxyMsgHelperTest, Sequential) {
GURL url1("http://www.google1.com/");
GURL url2("http://www.google2.com/");
GURL url3("http://www.google3.com/");
- scoped_ptr<IPC::Message> msg1(new IPC::Message());
- scoped_ptr<IPC::Message> msg2(new IPC::Message());
- scoped_ptr<IPC::Message> msg3(new IPC::Message());
+ // Messages are deleted by the sink.
+ IPC::Message* msg1 = GenerateReply();
+ IPC::Message* msg2 = GenerateReply();
+ IPC::Message* msg3 = GenerateReply();
// Execute each request sequentially (so there are never 2 requests
// outstanding at the same time).
- helper.Start(url1, msg1.get());
+ helper_->OnResolveProxy(url1, msg1);
// Finish ProxyService's initialization.
- resolver->pending_set_pac_script_request()->CompleteNow(net::OK);
+ resolver_->pending_set_pac_script_request()->CompleteNow(net::OK);
- ASSERT_EQ(1u, resolver->pending_requests().size());
- EXPECT_EQ(url1, resolver->pending_requests()[0]->url());
- resolver->pending_requests()[0]->results()->UseNamedProxy("result1:80");
- resolver->pending_requests()[0]->CompleteNow(net::OK);
+ ASSERT_EQ(1u, resolver_->pending_requests().size());
+ EXPECT_EQ(url1, resolver_->pending_requests()[0]->url());
+ resolver_->pending_requests()[0]->results()->UseNamedProxy("result1:80");
+ resolver_->pending_requests()[0]->CompleteNow(net::OK);
// Check result.
- EXPECT_EQ(msg1.get(), delegate.pending_result()->msg);
- EXPECT_EQ(net::OK, delegate.pending_result()->error_code);
- EXPECT_EQ("PROXY result1:80", delegate.pending_result()->proxy_list);
- delegate.clear_pending_result();
+ EXPECT_EQ(net::OK, pending_result()->error_code);
+ EXPECT_EQ("PROXY result1:80", pending_result()->proxy_list);
+ clear_pending_result();
- helper.Start(url2, msg2.get());
+ helper_->OnResolveProxy(url2, msg2);
- ASSERT_EQ(1u, resolver->pending_requests().size());
- EXPECT_EQ(url2, resolver->pending_requests()[0]->url());
- resolver->pending_requests()[0]->results()->UseNamedProxy("result2:80");
- resolver->pending_requests()[0]->CompleteNow(net::OK);
+ ASSERT_EQ(1u, resolver_->pending_requests().size());
+ EXPECT_EQ(url2, resolver_->pending_requests()[0]->url());
+ resolver_->pending_requests()[0]->results()->UseNamedProxy("result2:80");
+ resolver_->pending_requests()[0]->CompleteNow(net::OK);
// Check result.
- EXPECT_EQ(msg2.get(), delegate.pending_result()->msg);
- EXPECT_EQ(net::OK, delegate.pending_result()->error_code);
- EXPECT_EQ("PROXY result2:80", delegate.pending_result()->proxy_list);
- delegate.clear_pending_result();
+ EXPECT_EQ(net::OK, pending_result()->error_code);
+ EXPECT_EQ("PROXY result2:80", pending_result()->proxy_list);
+ clear_pending_result();
- helper.Start(url3, msg3.get());
+ helper_->OnResolveProxy(url3, msg3);
- ASSERT_EQ(1u, resolver->pending_requests().size());
- EXPECT_EQ(url3, resolver->pending_requests()[0]->url());
- resolver->pending_requests()[0]->results()->UseNamedProxy("result3:80");
- resolver->pending_requests()[0]->CompleteNow(net::OK);
+ ASSERT_EQ(1u, resolver_->pending_requests().size());
+ EXPECT_EQ(url3, resolver_->pending_requests()[0]->url());
+ resolver_->pending_requests()[0]->results()->UseNamedProxy("result3:80");
+ resolver_->pending_requests()[0]->CompleteNow(net::OK);
// Check result.
- EXPECT_EQ(msg3.get(), delegate.pending_result()->msg);
- EXPECT_EQ(net::OK, delegate.pending_result()->error_code);
- EXPECT_EQ("PROXY result3:80", delegate.pending_result()->proxy_list);
- delegate.clear_pending_result();
+ EXPECT_EQ(net::OK, pending_result()->error_code);
+ EXPECT_EQ("PROXY result3:80", pending_result()->proxy_list);
+ clear_pending_result();
}
// Issue a request while one is already in progress -- should be queued.
-TEST(ResolveProxyMsgHelperTest, QueueRequests) {
- net::MockAsyncProxyResolver* resolver = new net::MockAsyncProxyResolver;
- scoped_refptr<net::ProxyService> service(
- new net::ProxyService(new MockProxyConfigService, resolver, NULL));
-
- MyDelegate delegate;
- ResolveProxyMsgHelper helper(&delegate, service);
-
+TEST_F(ResolveProxyMsgHelperTest, QueueRequests) {
GURL url1("http://www.google1.com/");
GURL url2("http://www.google2.com/");
GURL url3("http://www.google3.com/");
- scoped_ptr<IPC::Message> msg1(new IPC::Message());
- scoped_ptr<IPC::Message> msg2(new IPC::Message());
- scoped_ptr<IPC::Message> msg3(new IPC::Message());
+ IPC::Message* msg1 = GenerateReply();
+ IPC::Message* msg2 = GenerateReply();
+ IPC::Message* msg3 = GenerateReply();
// Start three requests. Since the proxy resolver is async, all the
// requests will be pending.
- helper.Start(url1, msg1.get());
+ helper_->OnResolveProxy(url1, msg1);
// Finish ProxyService's initialization.
- resolver->pending_set_pac_script_request()->CompleteNow(net::OK);
+ resolver_->pending_set_pac_script_request()->CompleteNow(net::OK);
- helper.Start(url2, msg2.get());
- helper.Start(url3, msg3.get());
+ helper_->OnResolveProxy(url2, msg2);
+ helper_->OnResolveProxy(url3, msg3);
// ResolveProxyHelper only keeps 1 request outstanding in ProxyService
// at a time.
- ASSERT_EQ(1u, resolver->pending_requests().size());
- EXPECT_EQ(url1, resolver->pending_requests()[0]->url());
+ ASSERT_EQ(1u, resolver_->pending_requests().size());
+ EXPECT_EQ(url1, resolver_->pending_requests()[0]->url());
- resolver->pending_requests()[0]->results()->UseNamedProxy("result1:80");
- resolver->pending_requests()[0]->CompleteNow(net::OK);
+ resolver_->pending_requests()[0]->results()->UseNamedProxy("result1:80");
+ resolver_->pending_requests()[0]->CompleteNow(net::OK);
// Check result.
- EXPECT_EQ(msg1.get(), delegate.pending_result()->msg);
- EXPECT_EQ(net::OK, delegate.pending_result()->error_code);
- EXPECT_EQ("PROXY result1:80", delegate.pending_result()->proxy_list);
- delegate.clear_pending_result();
+ EXPECT_EQ(net::OK, pending_result()->error_code);
+ EXPECT_EQ("PROXY result1:80", pending_result()->proxy_list);
+ clear_pending_result();
- ASSERT_EQ(1u, resolver->pending_requests().size());
- EXPECT_EQ(url2, resolver->pending_requests()[0]->url());
+ ASSERT_EQ(1u, resolver_->pending_requests().size());
+ EXPECT_EQ(url2, resolver_->pending_requests()[0]->url());
- resolver->pending_requests()[0]->results()->UseNamedProxy("result2:80");
- resolver->pending_requests()[0]->CompleteNow(net::OK);
+ resolver_->pending_requests()[0]->results()->UseNamedProxy("result2:80");
+ resolver_->pending_requests()[0]->CompleteNow(net::OK);
// Check result.
- EXPECT_EQ(msg2.get(), delegate.pending_result()->msg);
- EXPECT_EQ(net::OK, delegate.pending_result()->error_code);
- EXPECT_EQ("PROXY result2:80", delegate.pending_result()->proxy_list);
- delegate.clear_pending_result();
+ EXPECT_EQ(net::OK, pending_result()->error_code);
+ EXPECT_EQ("PROXY result2:80", pending_result()->proxy_list);
+ clear_pending_result();
- ASSERT_EQ(1u, resolver->pending_requests().size());
- EXPECT_EQ(url3, resolver->pending_requests()[0]->url());
+ ASSERT_EQ(1u, resolver_->pending_requests().size());
+ EXPECT_EQ(url3, resolver_->pending_requests()[0]->url());
- resolver->pending_requests()[0]->results()->UseNamedProxy("result3:80");
- resolver->pending_requests()[0]->CompleteNow(net::OK);
+ resolver_->pending_requests()[0]->results()->UseNamedProxy("result3:80");
+ resolver_->pending_requests()[0]->CompleteNow(net::OK);
// Check result.
- EXPECT_EQ(msg3.get(), delegate.pending_result()->msg);
- EXPECT_EQ(net::OK, delegate.pending_result()->error_code);
- EXPECT_EQ("PROXY result3:80", delegate.pending_result()->proxy_list);
- delegate.clear_pending_result();
+ EXPECT_EQ(net::OK, pending_result()->error_code);
+ EXPECT_EQ("PROXY result3:80", pending_result()->proxy_list);
+ clear_pending_result();
}
// Delete the helper while a request is in progress, and others are pending.
-TEST(ResolveProxyMsgHelperTest, CancelPendingRequests) {
- net::MockAsyncProxyResolver* resolver = new net::MockAsyncProxyResolver;
- scoped_refptr<net::ProxyService> service(
- new net::ProxyService(new MockProxyConfigService, resolver, NULL));
-
- MyDelegate delegate;
- scoped_ptr<ResolveProxyMsgHelper> helper(
- new ResolveProxyMsgHelper(&delegate, service));
-
+TEST_F(ResolveProxyMsgHelperTest, CancelPendingRequests) {
GURL url1("http://www.google1.com/");
GURL url2("http://www.google2.com/");
GURL url3("http://www.google3.com/");
- // NOTE: these are not scoped ptr, since they will be deleted by the
- // request's cancellation.
- IPC::Message* msg1 = new IPC::Message();
- IPC::Message* msg2 = new IPC::Message();
- IPC::Message* msg3 = new IPC::Message();
+ // They will be deleted by the request's cancellation.
+ IPC::Message* msg1 = GenerateReply();
+ IPC::Message* msg2 = GenerateReply();
+ IPC::Message* msg3 = GenerateReply();
// Start three requests. Since the proxy resolver is async, all the
// requests will be pending.
- helper->Start(url1, msg1);
+ helper_->OnResolveProxy(url1, msg1);
// Finish ProxyService's initialization.
- resolver->pending_set_pac_script_request()->CompleteNow(net::OK);
+ resolver_->pending_set_pac_script_request()->CompleteNow(net::OK);
- helper->Start(url2, msg2);
- helper->Start(url3, msg3);
+ helper_->OnResolveProxy(url2, msg2);
+ helper_->OnResolveProxy(url3, msg3);
// ResolveProxyHelper only keeps 1 request outstanding in ProxyService
// at a time.
- ASSERT_EQ(1u, resolver->pending_requests().size());
- EXPECT_EQ(url1, resolver->pending_requests()[0]->url());
+ ASSERT_EQ(1u, resolver_->pending_requests().size());
+ EXPECT_EQ(url1, resolver_->pending_requests()[0]->url());
// Delete the underlying ResolveProxyMsgHelper -- this should cancel all
// the requests which are outstanding.
- helper.reset();
+ helper_ = NULL;
// The pending requests sent to the proxy resolver should have been cancelled.
- EXPECT_EQ(0u, resolver->pending_requests().size());
+ EXPECT_EQ(0u, resolver_->pending_requests().size());
- EXPECT_TRUE(delegate.pending_result() == NULL);
+ EXPECT_TRUE(pending_result() == NULL);
// It should also be the case that msg1, msg2, msg3 were deleted by the
// cancellation. (Else will show up as a leak in Purify/Valgrind).
diff --git a/chrome/browser/plugin_data_remover.cc b/chrome/browser/plugin_data_remover.cc
index d4c1cef..ebbacc4 100644
--- a/chrome/browser/plugin_data_remover.cc
+++ b/chrome/browser/plugin_data_remover.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/message_loop_proxy.h"
#include "base/metrics/histogram.h"
+#include "base/synchronization/waitable_event.h"
#include "base/version.h"
#include "chrome/common/chrome_switches.h"
#include "content/browser/browser_thread.h"
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index dcb8ba7..e4698c9 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -37,6 +37,7 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/net/resolve_proxy_msg_helper.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/printing/printing_message_filter.h"
#include "chrome/browser/profiles/profile.h"
@@ -493,6 +494,8 @@ void BrowserRenderProcessHost::CreateMessageFilters() {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableP2PApi))
channel_->AddFilter(new P2PSocketsHost());
+
+ channel_->AddFilter(new ResolveProxyMsgHelper(NULL));
}
int BrowserRenderProcessHost::GetNextRoutingID() {
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 3c8d989..b12f474 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -1938,14 +1938,6 @@ IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetRootWindowRect,
gfx::NativeViewId /* window */,
gfx::Rect /* Out: Window location */)
-// Get the list of proxies to use for |url|, as a semicolon delimited list
-// of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also
-// PluginProcessHostMsg_ResolveProxy which does the same thing.
-IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ResolveProxy,
- GURL /* url */,
- int /* network error */,
- std::string /* proxy list */)
-
// Request that got sent to browser for creating an audio output stream
IPC_MESSAGE_ROUTED3(ViewHostMsg_CreateAudioStream,
int /* stream_id */,
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc
index c6c6842..66e780a 100644
--- a/chrome/plugin/plugin_thread.cc
+++ b/chrome/plugin/plugin_thread.cc
@@ -20,10 +20,10 @@
#include "base/process_util.h"
#include "base/threading/thread_local.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/render_messages.h"
#include "chrome/plugin/npobject_util.h"
#include "chrome/renderer/render_thread.h"
#include "content/common/child_process.h"
+#include "content/common/child_process_messages.h"
#include "content/common/plugin_messages.h"
#include "ipc/ipc_channel_handle.h"
#include "net/base/net_errors.h"
@@ -193,21 +193,12 @@ bool IsDefaultPluginEnabled() {
return true;
}
-// Dispatch the resolve proxy resquest to the right code, depending on which
-// process the plugin is running in {renderer, browser, plugin}.
bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
int net_error;
std::string proxy_result;
- bool result;
- if (IsPluginProcess()) {
- result = PluginThread::current()->Send(
- new PluginProcessHostMsg_ResolveProxy(url, &net_error, &proxy_result));
- } else {
- result = RenderThread::current()->Send(
- new ViewHostMsg_ResolveProxy(url, &net_error, &proxy_result));
- }
-
+ bool result = ChildThread::current()->Send(
+ new ChildProcessHostMsg_ResolveProxy(url, &net_error, &proxy_result));
if (!result || net_error != net::OK)
return false;
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc
index e3687a8..a34f1e90 100644
--- a/chrome/renderer/pepper_plugin_delegate_impl.cc
+++ b/chrome/renderer/pepper_plugin_delegate_impl.cc
@@ -29,6 +29,7 @@
#include "chrome/renderer/render_view.h"
#include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h"
#include "chrome/renderer/webplugin_delegate_proxy.h"
+#include "content/common/child_process_messages.h"
#include "content/common/child_thread.h"
#include "content/common/file_system/file_system_dispatcher.h"
#include "grit/locale_settings.h"
@@ -930,9 +931,8 @@ void PepperPluginDelegateImpl::ZoomLimitsChanged(double minimum_factor,
std::string PepperPluginDelegateImpl::ResolveProxy(const GURL& url) {
int net_error;
std::string proxy_result;
- IPC::Message* msg =
- new ViewHostMsg_ResolveProxy(url, &net_error, &proxy_result);
- RenderThread::current()->Send(msg);
+ RenderThread::current()->Send(
+ new ChildProcessHostMsg_ResolveProxy(url, &net_error, &proxy_result));
return proxy_result;
}