| 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 14 matching lines...) Expand all Loading... |
| 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 void WillStartRequest(bool* defer) override; | 34 void WillStartRequest(bool* defer) override; |
| 35 void WillRedirectRequest(const GURL& new_url, bool* defer) override; | 35 void WillRedirectRequest(const net::RedirectInfo& redirect_info, |
| 36 bool* defer) override; |
| 36 const char* GetNameForLogging() const override; | 37 const char* GetNameForLogging() const override; |
| 37 | 38 |
| 38 // Called by the PrerenderContents when a prerender becomes visible. | 39 // Called by the PrerenderContents when a prerender becomes visible. |
| 39 // May only be called if currently throttling the resource. | 40 // May only be called if currently throttling the resource. |
| 40 void Resume(); | 41 void Resume(); |
| 41 | 42 |
| 42 static void OverridePrerenderContentsForTesting(PrerenderContents* contents); | 43 static void OverridePrerenderContentsForTesting(PrerenderContents* contents); |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 // Helper method to cancel the request. May only be called if currently | 46 // Helper method to cancel the request. May only be called if currently |
| (...skipping 23 matching lines...) Expand all Loading... |
| 69 int render_process_id, int render_frame_id); | 70 int render_process_id, int render_frame_id); |
| 70 | 71 |
| 71 net::URLRequest* request_; | 72 net::URLRequest* request_; |
| 72 | 73 |
| 73 DISALLOW_COPY_AND_ASSIGN(PrerenderResourceThrottle); | 74 DISALLOW_COPY_AND_ASSIGN(PrerenderResourceThrottle); |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 } // namespace prerender | 77 } // namespace prerender |
| 77 | 78 |
| 78 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_RESOURCE_THROTTLE_H_ | 79 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_RESOURCE_THROTTLE_H_ |
| OLD | NEW |