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

Side by Side Diff: content/browser/loader/layered_resource_handler.h

Issue 2476163003: Refactor ResourceHandler API. (Closed)
Patch Set: Minor cleanups, one real fix Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 // A ResourceHandler that simply delegates all calls to a next handler. This 19 // A ResourceHandler that simply delegates all calls to a next handler. This
20 // class is intended to be subclassed. 20 // class is intended to be subclassed.
21 class CONTENT_EXPORT LayeredResourceHandler : public ResourceHandler { 21 class CONTENT_EXPORT LayeredResourceHandler : public ResourceHandler {
22 public: 22 public:
23 LayeredResourceHandler(net::URLRequest* request, 23 LayeredResourceHandler(net::URLRequest* request,
24 std::unique_ptr<ResourceHandler> next_handler); 24 std::unique_ptr<ResourceHandler> next_handler);
25 ~LayeredResourceHandler() override; 25 ~LayeredResourceHandler() override;
26 26
27 // ResourceHandler implementation: 27 // ResourceHandler implementation:
28 void SetController(ResourceController* controller) override; 28 void SetController(ResourceController* controller) override;
29 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, 29 void OnRequestRedirected(const net::RedirectInfo& redirect_info,
30 ResourceResponse* response, 30 ResourceResponse* response,
31 bool* defer) override; 31 bool* defer_or_cancel) override;
32 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; 32 void OnResponseStarted(ResourceResponse* response,
33 bool OnWillStart(const GURL& url, bool* defer) override; 33 bool* defer_or_cancel) override;
34 void OnWillStart(const GURL& url, bool* defer_or_cancel) override;
34 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, 35 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf,
35 int* buf_size, 36 int* buf_size,
36 int min_size) override; 37 int min_size) override;
37 bool OnReadCompleted(int bytes_read, bool* defer) override; 38 void OnReadCompleted(int bytes_read, bool* defer_or_cancel) override;
38 void OnResponseCompleted(const net::URLRequestStatus& status, 39 void OnResponseCompleted(const net::URLRequestStatus& status,
39 bool* defer) override; 40 bool* defer) override;
40 void OnDataDownloaded(int bytes_downloaded) override; 41 void OnDataDownloaded(int bytes_downloaded) override;
41 42
42 std::unique_ptr<ResourceHandler> next_handler_; 43 std::unique_ptr<ResourceHandler> next_handler_;
43 }; 44 };
44 45
45 } // namespace content 46 } // namespace content
46 47
47 #endif // CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_ 48 #endif // CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/loader/intercepting_resource_handler_unittest.cc ('k') | content/browser/loader/layered_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698