| 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_CROSS_SITE_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "content/browser/loader/layered_resource_handler.h" | 9 #include "content/browser/loader/layered_resource_handler.h" |
| 10 #include "content/common/content_export.h" |
| 10 #include "net/url_request/url_request_status.h" | 11 #include "net/url_request/url_request_status.h" |
| 11 | 12 |
| 12 namespace net { | 13 namespace net { |
| 13 class URLRequest; | 14 class URLRequest; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 // Ensures that cross-site responses are delayed until the onunload handler of | 19 // Ensures that cross-site responses are delayed until the onunload handler of |
| 19 // the previous page is allowed to run. This handler wraps an | 20 // the previous page is allowed to run. This handler wraps an |
| (...skipping 19 matching lines...) Expand all Loading... |
| 39 bool* defer) OVERRIDE; | 40 bool* defer) OVERRIDE; |
| 40 virtual void OnResponseCompleted(int request_id, | 41 virtual void OnResponseCompleted(int request_id, |
| 41 const net::URLRequestStatus& status, | 42 const net::URLRequestStatus& status, |
| 42 const std::string& security_info, | 43 const std::string& security_info, |
| 43 bool* defer) OVERRIDE; | 44 bool* defer) OVERRIDE; |
| 44 | 45 |
| 45 // We can now send the response to the new renderer, which will cause | 46 // We can now send the response to the new renderer, which will cause |
| 46 // WebContentsImpl to swap in the new renderer and destroy the old one. | 47 // WebContentsImpl to swap in the new renderer and destroy the old one. |
| 47 void ResumeResponse(); | 48 void ResumeResponse(); |
| 48 | 49 |
| 50 // When set to true, requests are leaked when they can't be passed to a |
| 51 // RenderViewHost, for unit tests. |
| 52 CONTENT_EXPORT static void SetLeakRequestsForTesting( |
| 53 bool leak_requests_for_testing); |
| 54 |
| 49 private: | 55 private: |
| 50 // Prepare to render the cross-site response in a new RenderViewHost, by | 56 // Prepare to render the cross-site response in a new RenderViewHost, by |
| 51 // telling the old RenderViewHost to run its onunload handler. | 57 // telling the old RenderViewHost to run its onunload handler. |
| 52 void StartCrossSiteTransition(int request_id, | 58 void StartCrossSiteTransition(int request_id, |
| 53 ResourceResponse* response, | 59 ResourceResponse* response, |
| 54 bool should_transfer); | 60 bool should_transfer); |
| 55 | 61 |
| 56 void ResumeIfDeferred(); | 62 void ResumeIfDeferred(); |
| 57 | 63 |
| 58 bool has_started_response_; | 64 bool has_started_response_; |
| 59 bool in_cross_site_transition_; | 65 bool in_cross_site_transition_; |
| 60 bool completed_during_transition_; | 66 bool completed_during_transition_; |
| 61 bool did_defer_; | 67 bool did_defer_; |
| 62 net::URLRequestStatus completed_status_; | 68 net::URLRequestStatus completed_status_; |
| 63 std::string completed_security_info_; | 69 std::string completed_security_info_; |
| 64 scoped_refptr<ResourceResponse> response_; | 70 scoped_refptr<ResourceResponse> response_; |
| 65 | 71 |
| 66 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); | 72 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); |
| 67 }; | 73 }; |
| 68 | 74 |
| 69 } // namespace content | 75 } // namespace content |
| 70 | 76 |
| 71 #endif // CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ | 77 #endif // CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ |
| OLD | NEW |