OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_PRERENDER_PRERENDER_RESOURCE_THROTTLE_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_RESOURCE_THROTTLE_H_ |
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_RESOURCE_THROTTLE_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_RESOURCE_THROTTLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 // content::ResourceThrottle implementation: | 40 // content::ResourceThrottle implementation: |
41 void WillStartRequest(bool* defer) override; | 41 void WillStartRequest(bool* defer) override; |
42 void WillRedirectRequest(const net::RedirectInfo& redirect_info, | 42 void WillRedirectRequest(const net::RedirectInfo& redirect_info, |
43 bool* defer) override; | 43 bool* defer) override; |
44 void WillProcessResponse(bool* defer) override; | 44 void WillProcessResponse(bool* defer) override; |
45 const char* GetNameForLogging() const override; | 45 const char* GetNameForLogging() const override; |
46 | 46 |
47 // Called by the PrerenderContents when a prerender becomes visible. | 47 // Called by the PrerenderContents when a prerender becomes visible. |
48 // May only be called if currently throttling the resource. | 48 // May only be called if currently throttling the resource. |
49 void Resume(); | 49 void ResumeHandler(); |
50 | 50 |
51 static void OverridePrerenderContentsForTesting(PrerenderContents* contents); | 51 static void OverridePrerenderContentsForTesting(PrerenderContents* contents); |
52 | 52 |
53 private: | 53 private: |
54 // Helper method to cancel the request. May only be called if currently | |
55 // throttling the resource. | |
56 void Cancel(); | |
57 | |
58 static void WillStartRequestOnUI( | 54 static void WillStartRequestOnUI( |
59 const base::WeakPtr<PrerenderResourceThrottle>& throttle, | 55 const base::WeakPtr<PrerenderResourceThrottle>& throttle, |
60 const std::string& method, | 56 const std::string& method, |
61 content::ResourceType resource_type, | 57 content::ResourceType resource_type, |
62 int render_process_id, | 58 int render_process_id, |
63 int render_frame_id, | 59 int render_frame_id, |
64 const GURL& url, | 60 const GURL& url, |
65 scoped_refptr<PrerenderThrottleInfo> prerender_throttle_info); | 61 scoped_refptr<PrerenderThrottleInfo> prerender_throttle_info); |
66 | 62 |
67 static void WillRedirectRequestOnUI( | 63 static void WillRedirectRequestOnUI( |
(...skipping 22 matching lines...) Expand all Loading... |
90 net::URLRequest* request_; | 86 net::URLRequest* request_; |
91 | 87 |
92 scoped_refptr<PrerenderThrottleInfo> prerender_throttle_info_; | 88 scoped_refptr<PrerenderThrottleInfo> prerender_throttle_info_; |
93 | 89 |
94 DISALLOW_COPY_AND_ASSIGN(PrerenderResourceThrottle); | 90 DISALLOW_COPY_AND_ASSIGN(PrerenderResourceThrottle); |
95 }; | 91 }; |
96 | 92 |
97 } // namespace prerender | 93 } // namespace prerender |
98 | 94 |
99 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_RESOURCE_THROTTLE_H_ | 95 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_RESOURCE_THROTTLE_H_ |
OLD | NEW |