summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-11 02:33:05 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-11 02:33:05 +0000
commit31033a317aec1ce92b6f07d0731aa70cc280e864 (patch)
tree5bb575ba8c6c43790bd200749d21fe50e0e650e9
parentef561a16b7ae7512ce87884a8577574bf8f4085c (diff)
downloadchromium_src-31033a317aec1ce92b6f07d0731aa70cc280e864.zip
chromium_src-31033a317aec1ce92b6f07d0731aa70cc280e864.tar.gz
chromium_src-31033a317aec1ce92b6f07d0731aa70cc280e864.tar.bz2
Revert 104832 - Move ResourceDispatcherHostDelegate to content\public\common. I've added a set delegate function on ChildThread (which will soon be on content::ChildThread interface) so that we don't have to expose ResourceDispatcher to embedders.
BUG=98716 Review URL: http://codereview.chromium.org/8224019 TBR=jam@chromium.org Review URL: http://codereview.chromium.org/8226015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104836 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/DEPS1
-rw-r--r--chrome/renderer/chrome_render_process_observer.cc10
-rw-r--r--chrome/renderer/chrome_render_process_observer.h9
-rw-r--r--chrome/renderer/mock_render_thread.cc4
-rw-r--r--chrome/renderer/mock_render_thread.h1
-rw-r--r--content/DEPS1
-rw-r--r--content/common/child_thread.cc5
-rw-r--r--content/common/child_thread.h8
-rw-r--r--content/common/resource_dispatcher.cc2
-rw-r--r--content/common/resource_dispatcher.h9
-rw-r--r--content/common/resource_dispatcher_delegate.cc27
-rw-r--r--content/common/resource_dispatcher_delegate.h (renamed from content/public/common/resource_dispatcher_delegate.h)17
-rw-r--r--content/content_common.gypi3
-rw-r--r--content/public/renderer/render_thread.h2
-rw-r--r--content/renderer/render_thread_impl.cc4
-rw-r--r--content/renderer/render_thread_impl.h1
16 files changed, 59 insertions, 45 deletions
diff --git a/chrome/DEPS b/chrome/DEPS
index 2580f54..4d20732 100644
--- a/chrome/DEPS
+++ b/chrome/DEPS
@@ -13,7 +13,6 @@ include_rules = [
"+chrome/test",
"-content",
"+content/common",
- "+content/public/common",
"+content/test",
# Don't allow inclusion of these other libs we shouldn't be calling directly.
diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc
index dd6edbd..ddd02b6 100644
--- a/chrome/renderer/chrome_render_process_observer.cc
+++ b/chrome/renderer/chrome_render_process_observer.cc
@@ -21,9 +21,9 @@
#include "chrome/renderer/chrome_content_renderer_client.h"
#include "chrome/renderer/content_settings_observer.h"
#include "chrome/renderer/security_filter_peer.h"
-#include "content/common/child_thread.h"
+#include "content/common/resource_dispatcher.h"
+#include "content/common/resource_dispatcher_delegate.h"
#include "content/common/view_messages.h"
-#include "content/public/common/resource_dispatcher_delegate.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view_visitor.h"
#include "content/public/renderer/render_view.h"
@@ -58,7 +58,7 @@ namespace {
static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */;
-class RendererResourceDelegate : public content::ResourceDispatcherDelegate {
+class RendererResourceDelegate : public ResourceDispatcherDelegate {
public:
RendererResourceDelegate()
: ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
@@ -211,9 +211,7 @@ ChromeRenderProcessObserver::ChromeRenderProcessObserver(
RenderThread* thread = RenderThread::Get();
resource_delegate_.reset(new RendererResourceDelegate());
-
- ChildThread* child_thread = ChildThread::current();
- child_thread->SetResourceDispatcherDelegate(resource_delegate_.get());
+ thread->GetResourceDispatcher()->set_delegate(resource_delegate_.get());
#if defined(OS_POSIX)
thread->AddFilter(new SuicideOnChannelErrorFilter());
diff --git a/chrome/renderer/chrome_render_process_observer.h b/chrome/renderer/chrome_render_process_observer.h
index 7c14c24..b7740e6 100644
--- a/chrome/renderer/chrome_render_process_observer.h
+++ b/chrome/renderer/chrome_render_process_observer.h
@@ -13,16 +13,13 @@
#include "base/memory/scoped_ptr.h"
#include "content/public/renderer/render_process_observer.h"
-class GURL;
-struct ContentSettings;
-
namespace chrome {
class ChromeContentRendererClient;
}
-namespace content {
+class GURL;
class ResourceDispatcherDelegate;
-}
+struct ContentSettings;
// This class filters the incoming control messages (i.e. ones not destined for
// a RenderView) for Chrome specific messages that the content layer doesn't
@@ -65,7 +62,7 @@ class ChromeRenderProcessObserver : public content::RenderProcessObserver {
void OnPurgeMemory();
static bool is_incognito_process_;
- scoped_ptr<content::ResourceDispatcherDelegate> resource_delegate_;
+ scoped_ptr<ResourceDispatcherDelegate> resource_delegate_;
chrome::ChromeContentRendererClient* client_;
// If true, the web cache shall be cleared before the next navigation event.
bool clear_cache_pending_;
diff --git a/chrome/renderer/mock_render_thread.cc b/chrome/renderer/mock_render_thread.cc
index 982e5ac..e36047e 100644
--- a/chrome/renderer/mock_render_thread.cc
+++ b/chrome/renderer/mock_render_thread.cc
@@ -66,6 +66,10 @@ IPC::SyncChannel* MockRenderThread::GetChannel() {
return NULL;
}
+ResourceDispatcher* MockRenderThread::GetResourceDispatcher() {
+ return NULL;
+}
+
std::string MockRenderThread::GetLocale() {
return std::string();
}
diff --git a/chrome/renderer/mock_render_thread.h b/chrome/renderer/mock_render_thread.h
index 31ce743..b0beefd 100644
--- a/chrome/renderer/mock_render_thread.h
+++ b/chrome/renderer/mock_render_thread.h
@@ -46,6 +46,7 @@ class MockRenderThread : public content::RenderThread {
virtual bool Send(IPC::Message* msg) OVERRIDE;
virtual MessageLoop* GetMessageLoop() OVERRIDE;
virtual IPC::SyncChannel* GetChannel() OVERRIDE;
+ virtual ResourceDispatcher* GetResourceDispatcher() OVERRIDE;
virtual std::string GetLocale() OVERRIDE;
virtual void AddRoute(int32 routing_id,
IPC::Channel::Listener* listener) OVERRIDE;
diff --git a/content/DEPS b/content/DEPS
index c47f7c4..8742fd4 100644
--- a/content/DEPS
+++ b/content/DEPS
@@ -19,7 +19,6 @@ include_rules = [
# directories in content/ so we disallow all of them.
"-content",
"+content/common",
- "+content/public/common",
"+content/test",
"+dbus",
diff --git a/content/common/child_thread.cc b/content/common/child_thread.cc
index 81dbd7b..bfde285 100644
--- a/content/common/child_thread.cc
+++ b/content/common/child_thread.cc
@@ -114,11 +114,6 @@ void ChildThread::RemoveRoute(int32 routing_id) {
router_.RemoveRoute(routing_id);
}
-void ChildThread::SetResourceDispatcherDelegate(
- content::ResourceDispatcherDelegate* delegate) {
- resource_dispatcher_->set_delegate(delegate);
-}
-
IPC::Channel::Listener* ChildThread::ResolveRoute(int32 routing_id) {
DCHECK(MessageLoop::current() == message_loop());
diff --git a/content/common/child_thread.h b/content/common/child_thread.h
index f7cf5dc..356ffd5 100644
--- a/content/common/child_thread.h
+++ b/content/common/child_thread.h
@@ -24,10 +24,6 @@ class SyncChannel;
class SyncMessageFilter;
}
-namespace content {
-class ResourceDispatcherDelegate;
-}
-
// The main thread of a child process derives from this class.
class CONTENT_EXPORT ChildThread : public IPC::Channel::Listener,
public IPC::Message::Sender {
@@ -45,10 +41,6 @@ class CONTENT_EXPORT ChildThread : public IPC::Channel::Listener,
void AddRoute(int32 routing_id, IPC::Channel::Listener* listener);
void RemoveRoute(int32 routing_id);
- // Set the ResourceDispatcher delegate object for this process.
- void SetResourceDispatcherDelegate(
- content::ResourceDispatcherDelegate* delegate);
-
IPC::Channel::Listener* ResolveRoute(int32 routing_id);
IPC::SyncChannel* channel() { return channel_.get(); }
diff --git a/content/common/resource_dispatcher.cc b/content/common/resource_dispatcher.cc
index 29e3c05d..d3f5185 100644
--- a/content/common/resource_dispatcher.cc
+++ b/content/common/resource_dispatcher.cc
@@ -13,9 +13,9 @@
#include "base/shared_memory.h"
#include "base/string_util.h"
#include "content/common/request_extra_data.h"
+#include "content/common/resource_dispatcher_delegate.h"
#include "content/common/resource_messages.h"
#include "content/common/resource_response.h"
-#include "content/public/common/resource_dispatcher_delegate.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/base/upload_data.h"
diff --git a/content/common/resource_dispatcher.h b/content/common/resource_dispatcher.h
index 2200282..fd400fe 100644
--- a/content/common/resource_dispatcher.h
+++ b/content/common/resource_dispatcher.h
@@ -19,11 +19,8 @@
#include "ipc/ipc_channel.h"
#include "webkit/glue/resource_loader_bridge.h"
-struct ResourceResponseHead;
-
-namespace content {
class ResourceDispatcherDelegate;
-}
+struct ResourceResponseHead;
// This class serves as a communication interface between the
// ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in
@@ -64,7 +61,7 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Channel::Listener {
// This does not take ownership of the delegate. It is expected that the
// delegate have a longer lifetime than the ResourceDispatcher.
- void set_delegate(content::ResourceDispatcherDelegate* delegate) {
+ void set_delegate(ResourceDispatcherDelegate* delegate) {
delegate_ = delegate;
}
@@ -156,7 +153,7 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Channel::Listener {
ScopedRunnableMethodFactory<ResourceDispatcher> method_factory_;
- content::ResourceDispatcherDelegate* delegate_;
+ ResourceDispatcherDelegate* delegate_;
DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher);
};
diff --git a/content/common/resource_dispatcher_delegate.cc b/content/common/resource_dispatcher_delegate.cc
new file mode 100644
index 0000000..75776d5
--- /dev/null
+++ b/content/common/resource_dispatcher_delegate.cc
@@ -0,0 +1,27 @@
+// 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 "content/common/resource_dispatcher_delegate.h"
+
+ResourceDispatcherDelegate::ResourceDispatcherDelegate() {
+}
+
+ResourceDispatcherDelegate::~ResourceDispatcherDelegate() {
+}
+
+webkit_glue::ResourceLoaderBridge::Peer*
+ ResourceDispatcherDelegate::OnRequestComplete(
+ webkit_glue::ResourceLoaderBridge::Peer* current_peer,
+ ResourceType::Type resource_type,
+ const net::URLRequestStatus& status) {
+ return NULL;
+}
+
+webkit_glue::ResourceLoaderBridge::Peer*
+ ResourceDispatcherDelegate::OnReceivedResponse(
+ webkit_glue::ResourceLoaderBridge::Peer* current_peer,
+ const std::string& mime_type,
+ const GURL& url) {
+ return NULL;
+}
diff --git a/content/public/common/resource_dispatcher_delegate.h b/content/common/resource_dispatcher_delegate.h
index 8f3ff61..c19ed57 100644
--- a/content/public/common/resource_dispatcher_delegate.h
+++ b/content/common/resource_dispatcher_delegate.h
@@ -2,32 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_PUBLIC_COMMON_RESOURCE_DISPATCHER_DELEGATE_H_
-#define CONTENT_PUBLIC_COMMON_RESOURCE_DISPATCHER_DELEGATE_H_
+#ifndef CONTENT_COMMON_RESOURCE_DISPATCHER_DELEGATE_H_
+#define CONTENT_COMMON_RESOURCE_DISPATCHER_DELEGATE_H_
#pragma once
#include "content/common/content_export.h"
#include "webkit/glue/resource_loader_bridge.h"
-namespace content {
-
// Interface that allows observing request events and optionally replacing the
// peer.
class CONTENT_EXPORT ResourceDispatcherDelegate {
public:
- virtual ~ResourceDispatcherDelegate() {}
+ ResourceDispatcherDelegate();
+ virtual ~ResourceDispatcherDelegate();
virtual webkit_glue::ResourceLoaderBridge::Peer* OnRequestComplete(
webkit_glue::ResourceLoaderBridge::Peer* current_peer,
ResourceType::Type resource_type,
- const net::URLRequestStatus& status) = 0;
+ const net::URLRequestStatus& status);
virtual webkit_glue::ResourceLoaderBridge::Peer* OnReceivedResponse(
webkit_glue::ResourceLoaderBridge::Peer* current_peer,
const std::string& mime_type,
- const GURL& url) = 0;
+ const GURL& url);
};
-} // namespace content
-
-#endif // CONTENT_PUBLIC_COMMON_RESOURCE_DISPATCHER_DELEGATE_H_
+#endif // CONTENT_COMMON_RESOURCE_DISPATCHER_DELEGATE_H_
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 382632d..c32f977 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -28,7 +28,6 @@
'../base/base.gyp:base',
],
'sources': [
- 'public/common/resource_dispatcher_delegate.h',
'common/appcache/appcache_backend_proxy.cc',
'common/appcache/appcache_backend_proxy.h',
'common/appcache/appcache_dispatcher.cc',
@@ -209,6 +208,8 @@
'common/request_extra_data.h',
'common/resource_dispatcher.cc',
'common/resource_dispatcher.h',
+ 'common/resource_dispatcher_delegate.cc',
+ 'common/resource_dispatcher_delegate.h',
'common/resource_messages.h',
'common/resource_response.cc',
'common/resource_response.h',
diff --git a/content/public/renderer/render_thread.h b/content/public/renderer/render_thread.h
index 377f6db..a7659e4 100644
--- a/content/public/renderer/render_thread.h
+++ b/content/public/renderer/render_thread.h
@@ -15,6 +15,7 @@
#endif
class MessageLoop;
+class ResourceDispatcher;
namespace IPC {
class SyncChannel;
@@ -39,6 +40,7 @@ class CONTENT_EXPORT RenderThread : public IPC::Message::Sender {
virtual MessageLoop* GetMessageLoop() = 0;
virtual IPC::SyncChannel* GetChannel() = 0;
+ virtual ResourceDispatcher* GetResourceDispatcher() = 0;
virtual std::string GetLocale() = 0;
// Called to add or remove a listener for a particular message routing ID.
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 91939d4..f1089b7 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -340,6 +340,10 @@ IPC::SyncChannel* RenderThreadImpl::GetChannel() {
return channel();
}
+ResourceDispatcher* RenderThreadImpl::GetResourceDispatcher() {
+ return resource_dispatcher();
+}
+
std::string RenderThreadImpl::GetLocale() {
// The browser process should have passed the locale to the renderer via the
// --lang command line flag. In single process mode, this will return the
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 0855ce8..092dcb4 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -93,6 +93,7 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
virtual bool Send(IPC::Message* msg) OVERRIDE;
virtual MessageLoop* GetMessageLoop() OVERRIDE;
virtual IPC::SyncChannel* GetChannel() OVERRIDE;
+ virtual ResourceDispatcher* GetResourceDispatcher() OVERRIDE;
virtual std::string GetLocale() OVERRIDE;
virtual void AddRoute(int32 routing_id,
IPC::Channel::Listener* listener) OVERRIDE;