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_THROTTLING_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_THROTTLING_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_THROTTLING_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_THROTTLING_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
| 13 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "content/browser/loader/layered_resource_handler.h" | 15 #include "content/browser/loader/layered_resource_handler.h" |
| 16 #include "content/common/content_export.h" |
15 #include "content/public/browser/resource_throttle.h" | 17 #include "content/public/browser/resource_throttle.h" |
16 #include "net/url_request/redirect_info.h" | 18 #include "net/url_request/redirect_info.h" |
17 #include "url/gurl.h" | 19 #include "url/gurl.h" |
18 | 20 |
19 namespace net { | 21 namespace net { |
20 class URLRequest; | 22 class URLRequest; |
21 } | 23 } |
22 | 24 |
23 namespace content { | 25 namespace content { |
24 | 26 |
25 struct ResourceResponse; | 27 struct ResourceResponse; |
26 | 28 |
27 // Used to apply a list of ResourceThrottle instances to an URLRequest. | 29 // Used to apply a list of ResourceThrottle instances to an URLRequest. |
28 class ThrottlingResourceHandler : public LayeredResourceHandler, | 30 class CONTENT_EXPORT ThrottlingResourceHandler |
29 public ResourceThrottle::Delegate { | 31 : public LayeredResourceHandler, |
| 32 public ResourceThrottle::Delegate { |
30 public: | 33 public: |
31 ThrottlingResourceHandler( | 34 ThrottlingResourceHandler( |
32 std::unique_ptr<ResourceHandler> next_handler, | 35 std::unique_ptr<ResourceHandler> next_handler, |
33 net::URLRequest* request, | 36 net::URLRequest* request, |
34 std::vector<std::unique_ptr<ResourceThrottle>> throttles); | 37 std::vector<std::unique_ptr<ResourceThrottle>> throttles); |
35 ~ThrottlingResourceHandler() override; | 38 ~ThrottlingResourceHandler() override; |
36 | 39 |
37 // LayeredResourceHandler overrides: | 40 // LayeredResourceHandler overrides: |
38 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 41 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
39 ResourceResponse* response, | 42 ResourceResponse* response, |
(...skipping 25 matching lines...) Expand all Loading... |
65 DeferredStage deferred_stage_; | 68 DeferredStage deferred_stage_; |
66 | 69 |
67 std::vector<std::unique_ptr<ResourceThrottle>> throttles_; | 70 std::vector<std::unique_ptr<ResourceThrottle>> throttles_; |
68 size_t next_index_; | 71 size_t next_index_; |
69 | 72 |
70 GURL deferred_url_; | 73 GURL deferred_url_; |
71 net::RedirectInfo deferred_redirect_; | 74 net::RedirectInfo deferred_redirect_; |
72 scoped_refptr<ResourceResponse> deferred_response_; | 75 scoped_refptr<ResourceResponse> deferred_response_; |
73 | 76 |
74 bool cancelled_by_resource_throttle_; | 77 bool cancelled_by_resource_throttle_; |
| 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(ThrottlingResourceHandler); |
75 }; | 80 }; |
76 | 81 |
77 } // namespace content | 82 } // namespace content |
78 | 83 |
79 #endif // CONTENT_BROWSER_LOADER_THROTTLING_RESOURCE_HANDLER_H_ | 84 #endif // CONTENT_BROWSER_LOADER_THROTTLING_RESOURCE_HANDLER_H_ |
OLD | NEW |