Chromium Code Reviews| 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); |
| }; |