1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/loader/resource_handler.h"
10 #include "content/common/content_export.h"
18 // A ResourceHandler that simply delegates all calls to a next handler. This
19 // class is intended to be subclassed.
20 class CONTENT_EXPORT LayeredResourceHandler
: public ResourceHandler
{
22 LayeredResourceHandler(net::URLRequest
* request
,
23 scoped_ptr
<ResourceHandler
> next_handler
);
24 ~LayeredResourceHandler() override
;
26 // ResourceHandler implementation:
27 void SetController(ResourceController
* controller
) override
;
28 bool OnRequestRedirected(const net::RedirectInfo
& redirect_info
,
29 ResourceResponse
* response
,
30 bool* defer
) override
;
31 bool OnResponseStarted(ResourceResponse
* response
, bool* defer
) override
;
32 bool OnWillStart(const GURL
& url
, bool* defer
) override
;
33 bool OnBeforeNetworkStart(const GURL
& url
, bool* defer
) override
;
34 bool OnWillRead(scoped_refptr
<net::IOBuffer
>* buf
,
36 int min_size
) override
;
37 bool OnReadCompleted(int bytes_read
, bool* defer
) override
;
38 void OnResponseCompleted(const net::URLRequestStatus
& status
,
39 const std::string
& security_info
,
40 bool* defer
) override
;
41 void OnDataDownloaded(int bytes_downloaded
) override
;
43 scoped_ptr
<ResourceHandler
> next_handler_
;
46 } // namespace content
48 #endif // CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_