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_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ |
7 | 7 |
8 namespace net { | 8 namespace net { |
9 struct RedirectInfo; | 9 struct RedirectInfo; |
10 } | 10 } |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 class AsyncRevalidationDriver; | 14 class AsyncRevalidationDriver; |
15 class ResourceController; | 15 class ResourceController; |
16 class ThrottlingResourceHandler; | 16 class ThrottlingResourceHandler; |
17 | 17 |
18 // A ResourceThrottle gets notified at various points during the process of | 18 // A ResourceThrottle gets notified at various points during the process of |
19 // loading a resource. At each stage, it has the opportunity to defer the | 19 // loading a resource. At each stage, it has the opportunity to defer the |
20 // resource load. The ResourceController interface may be used to resume a | 20 // resource load. The ResourceController interface may be used to resume a |
21 // deferred resource load, or it may be used to cancel a resource load at any | 21 // deferred resource load, or it may be used to cancel a resource load at any |
22 // time. | 22 // time. |
23 class ResourceThrottle { | 23 class ResourceThrottle { |
24 public: | 24 public: |
25 virtual ~ResourceThrottle() {} | 25 virtual ~ResourceThrottle() {} |
26 | 26 |
27 // Called before the resource request is started. | 27 // Called before the resource request is started. |
28 virtual void WillStartRequest(bool* defer) {} | 28 virtual void WillStartRequest(bool* defer) {} |
29 | 29 |
30 // Called before the resource request uses the network for the first time. | |
31 virtual void WillStartUsingNetwork(bool* defer) {} | |
32 | |
33 // Called when the request was redirected. |redirect_info| contains the | 30 // Called when the request was redirected. |redirect_info| contains the |
34 // redirect responses's HTTP status code and some information about the new | 31 // redirect responses's HTTP status code and some information about the new |
35 // request that will be sent if the redirect is followed, including the new | 32 // request that will be sent if the redirect is followed, including the new |
36 // URL and new method. | 33 // URL and new method. |
37 virtual void WillRedirectRequest(const net::RedirectInfo& redirect_info, | 34 virtual void WillRedirectRequest(const net::RedirectInfo& redirect_info, |
38 bool* defer) {} | 35 bool* defer) {} |
39 | 36 |
40 // Called when the response headers and meta data are available. | 37 // Called when the response headers and meta data are available. |
41 virtual void WillProcessResponse(bool* defer) {} | 38 virtual void WillProcessResponse(bool* defer) {} |
42 | 39 |
(...skipping 14 matching lines...) Expand all Loading... |
57 friend class AsyncRevalidationDriver; | 54 friend class AsyncRevalidationDriver; |
58 friend class ThrottlingResourceHandler; | 55 friend class ThrottlingResourceHandler; |
59 void set_controller(ResourceController* c) { controller_ = c; } | 56 void set_controller(ResourceController* c) { controller_ = c; } |
60 | 57 |
61 ResourceController* controller_; | 58 ResourceController* controller_; |
62 }; | 59 }; |
63 | 60 |
64 } // namespace content | 61 } // namespace content |
65 | 62 |
66 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ | 63 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_ |
OLD | NEW |