OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "content/browser/loader/resource_handler.h" | 10 #include "content/browser/loader/resource_handler.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 class URLRequest; | 14 class URLRequest; |
15 } // namespace net | 15 } // namespace net |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
| 19 class ResourceController; |
| 20 |
19 // A ResourceHandler that simply delegates all calls to a next handler. This | 21 // A ResourceHandler that simply delegates all calls to a next handler. This |
20 // class is intended to be subclassed. | 22 // class is intended to be subclassed. |
21 class CONTENT_EXPORT LayeredResourceHandler : public ResourceHandler { | 23 class CONTENT_EXPORT LayeredResourceHandler : public ResourceHandler { |
22 public: | 24 public: |
23 LayeredResourceHandler(net::URLRequest* request, | 25 LayeredResourceHandler(net::URLRequest* request, |
24 std::unique_ptr<ResourceHandler> next_handler); | 26 std::unique_ptr<ResourceHandler> next_handler); |
25 ~LayeredResourceHandler() override; | 27 ~LayeredResourceHandler() override; |
26 | 28 |
27 // ResourceHandler implementation: | 29 // ResourceHandler implementation: |
28 void SetController(ResourceController* controller) override; | 30 void SetDelegate(Delegate* delegate) override; |
29 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 31 void OnRequestRedirected( |
30 ResourceResponse* response, | 32 const net::RedirectInfo& redirect_info, |
31 bool* defer) override; | 33 ResourceResponse* response, |
32 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; | 34 std::unique_ptr<ResourceController> controller) override; |
33 bool OnWillStart(const GURL& url, bool* defer) override; | 35 void OnResponseStarted( |
| 36 ResourceResponse* response, |
| 37 std::unique_ptr<ResourceController> controller) override; |
| 38 void OnWillStart(const GURL& url, |
| 39 std::unique_ptr<ResourceController> controller) override; |
34 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 40 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
35 int* buf_size, | 41 int* buf_size, |
36 int min_size) override; | 42 int min_size) override; |
37 bool OnReadCompleted(int bytes_read, bool* defer) override; | 43 void OnReadCompleted(int bytes_read, |
38 void OnResponseCompleted(const net::URLRequestStatus& status, | 44 std::unique_ptr<ResourceController> controller) override; |
39 bool* defer) override; | 45 void OnResponseCompleted( |
| 46 const net::URLRequestStatus& status, |
| 47 std::unique_ptr<ResourceController> controller) override; |
40 void OnDataDownloaded(int bytes_downloaded) override; | 48 void OnDataDownloaded(int bytes_downloaded) override; |
41 | 49 |
42 std::unique_ptr<ResourceHandler> next_handler_; | 50 std::unique_ptr<ResourceHandler> next_handler_; |
43 }; | 51 }; |
44 | 52 |
45 } // namespace content | 53 } // namespace content |
46 | 54 |
47 #endif // CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_ | 55 #endif // CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_ |
OLD | NEW |