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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // | 24 // |
25 // TODO(davidben): Experiment with deferring network requests that | 25 // TODO(davidben): Experiment with deferring network requests that |
26 // would otherwise cancel the prerender. | 26 // would otherwise cancel the prerender. |
27 class PrerenderResourceThrottle | 27 class PrerenderResourceThrottle |
28 : public content::ResourceThrottle, | 28 : public content::ResourceThrottle, |
29 public base::SupportsWeakPtr<PrerenderResourceThrottle> { | 29 public base::SupportsWeakPtr<PrerenderResourceThrottle> { |
30 public: | 30 public: |
31 explicit PrerenderResourceThrottle(net::URLRequest* request); | 31 explicit PrerenderResourceThrottle(net::URLRequest* request); |
32 | 32 |
33 // content::ResourceThrottle implementation: | 33 // content::ResourceThrottle implementation: |
34 virtual void WillStartRequest(bool* defer) OVERRIDE; | 34 virtual void WillStartRequest(bool* defer) override; |
35 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; | 35 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) override; |
36 virtual const char* GetNameForLogging() const OVERRIDE; | 36 virtual const char* GetNameForLogging() const override; |
37 | 37 |
38 // Called by the PrerenderContents when a prerender becomes visible. | 38 // Called by the PrerenderContents when a prerender becomes visible. |
39 // May only be called if currently throttling the resource. | 39 // May only be called if currently throttling the resource. |
40 void Resume(); | 40 void Resume(); |
41 | 41 |
42 static void OverridePrerenderContentsForTesting(PrerenderContents* contents); | 42 static void OverridePrerenderContentsForTesting(PrerenderContents* contents); |
43 | 43 |
44 private: | 44 private: |
45 // Helper method to cancel the request. May only be called if currently | 45 // Helper method to cancel the request. May only be called if currently |
46 // throttling the resource. | 46 // throttling the resource. |
(...skipping 22 matching lines...) Expand all Loading... |
69 int render_process_id, int render_frame_id); | 69 int render_process_id, int render_frame_id); |
70 | 70 |
71 net::URLRequest* request_; | 71 net::URLRequest* request_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(PrerenderResourceThrottle); | 73 DISALLOW_COPY_AND_ASSIGN(PrerenderResourceThrottle); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace prerender | 76 } // namespace prerender |
77 | 77 |
78 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_RESOURCE_THROTTLE_H_ | 78 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_RESOURCE_THROTTLE_H_ |
OLD | NEW |