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 // In the case that the request is being transferred and the cross-site | |
51 // navigation is cancelled, cancels and deletes the request. This is needed | |
52 // to avoid leaking the request. | |
53 void AbortTransfer(); | |
Charlie Reis
2014/02/15 01:25:45
Let's remove this.
mmenke
2014/02/15 02:15:13
Done, thanks for catching this!
| |
54 | |
55 // When set to true, requests are leaked when they can't be passed to a | |
56 // RenderViewHost, for unit tests. | |
57 CONTENT_EXPORT static void SetLeakRequestsForTesting( | |
58 bool leak_requests_for_testing); | |
59 | |
49 private: | 60 private: |
50 // Prepare to render the cross-site response in a new RenderViewHost, by | 61 // Prepare to render the cross-site response in a new RenderViewHost, by |
51 // telling the old RenderViewHost to run its onunload handler. | 62 // telling the old RenderViewHost to run its onunload handler. |
52 void StartCrossSiteTransition(int request_id, | 63 void StartCrossSiteTransition(int request_id, |
53 ResourceResponse* response, | 64 ResourceResponse* response, |
54 bool should_transfer); | 65 bool should_transfer); |
55 | 66 |
56 void ResumeIfDeferred(); | 67 void ResumeIfDeferred(); |
57 | 68 |
58 bool has_started_response_; | 69 bool has_started_response_; |
59 bool in_cross_site_transition_; | 70 bool in_cross_site_transition_; |
60 bool completed_during_transition_; | 71 bool completed_during_transition_; |
61 bool did_defer_; | 72 bool did_defer_; |
62 net::URLRequestStatus completed_status_; | 73 net::URLRequestStatus completed_status_; |
63 std::string completed_security_info_; | 74 std::string completed_security_info_; |
64 scoped_refptr<ResourceResponse> response_; | 75 scoped_refptr<ResourceResponse> response_; |
65 | 76 |
66 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); | 77 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); |
67 }; | 78 }; |
68 | 79 |
69 } // namespace content | 80 } // namespace content |
70 | 81 |
71 #endif // CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ | 82 #endif // CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ |
OLD | NEW |