Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: content/browser/renderer_host/resource_dispatcher_host.h

Issue 6966017: Remove a chrome dependency by removing Prerender from ResourceDispatcherHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: abort all prerender requests Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/resource_dispatcher_host.h
diff --git a/content/browser/renderer_host/resource_dispatcher_host.h b/content/browser/renderer_host/resource_dispatcher_host.h
index f8643fed4056f0b05256172c29875ca7d7ad1927..94392cd21c3392f050304e426c419f4f1018a9bf 100644
--- a/content/browser/renderer_host/resource_dispatcher_host.h
+++ b/content/browser/renderer_host/resource_dispatcher_host.h
@@ -59,6 +59,23 @@ class DeletableFileReference;
class ResourceDispatcherHost : public net::URLRequest::Delegate {
public:
+ class Observer {
+ public:
+ // Called when a request begins. Return false to abort the request.
+ virtual bool ShouldBeginRequest(int child_id, int route_id,
mmenke 2011/05/25 00:56:24 nit: Move first two parameters to next line.
dominich 2011/05/25 16:42:28 Done.
+ const ResourceHostMsg_Request& request_data,
+ const content::ResourceContext& resource_context,
+ const GURL& referrer) = 0;
+
+ // Called after the load flags have been set when a request begins. Use it
+ // to add or remove load flags.
+ virtual void MutateLoadFlags(int child_id, int route_id,
+ int* load_flags) = 0;
+ protected:
+ Observer() {}
+ virtual ~Observer() {}
+ };
+
explicit ResourceDispatcherHost(
const ResourceQueue::DelegateSet& resource_queue_delegates);
~ResourceDispatcherHost();
@@ -244,6 +261,10 @@ class ResourceDispatcherHost : public net::URLRequest::Delegate {
static bool is_prefetch_enabled();
static void set_is_prefetch_enabled(bool value);
+ // This does not take ownership of the observer. It is expected that the
+ // observer have a longer lifetime than the ResourceDispatcherHost.
+ void set_observer(Observer* observer) { observer_ = observer; }
+
private:
FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
TestBlockedRequestsProcessDies);
@@ -476,8 +497,9 @@ class ResourceDispatcherHost : public net::URLRequest::Delegate {
// to the source of the message.
ResourceMessageFilter* filter_;
- static bool is_prefetch_enabled_;
+ Observer* observer_;
+ static bool is_prefetch_enabled_;
DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost);
};

Powered by Google App Engine
This is Rietveld 408576698