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