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 "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/browser/loader/layered_resource_handler.h" | 10 #include "content/browser/loader/layered_resource_handler.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "net/url_request/url_request_status.h" | 12 #include "net/url_request/url_request_status.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 class URLRequest; | 15 class URLRequest; |
16 } | 16 } |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
| 20 struct TransitionLayerData; |
| 21 |
20 // Ensures that cross-site responses are delayed until the onunload handler of | 22 // Ensures that cross-site responses are delayed until the onunload handler of |
21 // the previous page is allowed to run. This handler wraps an | 23 // the previous page is allowed to run. This handler wraps an |
22 // AsyncEventHandler, and it sits inside SafeBrowsing and Buffered event | 24 // AsyncEventHandler, and it sits inside SafeBrowsing and Buffered event |
23 // handlers. This is important, so that it can intercept OnResponseStarted | 25 // handlers. This is important, so that it can intercept OnResponseStarted |
24 // after we determine that a response is safe and not a download. | 26 // after we determine that a response is safe and not a download. |
25 class CrossSiteResourceHandler : public LayeredResourceHandler { | 27 class CrossSiteResourceHandler : public LayeredResourceHandler { |
26 public: | 28 public: |
27 CrossSiteResourceHandler(scoped_ptr<ResourceHandler> next_handler, | 29 CrossSiteResourceHandler(scoped_ptr<ResourceHandler> next_handler, |
28 net::URLRequest* request); | 30 net::URLRequest* request); |
29 virtual ~CrossSiteResourceHandler(); | 31 virtual ~CrossSiteResourceHandler(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // telling the old RenderViewHost to run its onunload handler. | 64 // telling the old RenderViewHost to run its onunload handler. |
63 void StartCrossSiteTransition(ResourceResponse* response, | 65 void StartCrossSiteTransition(ResourceResponse* response, |
64 bool should_transfer); | 66 bool should_transfer); |
65 | 67 |
66 // Defer the navigation to the UI thread to check whether transfer is required | 68 // Defer the navigation to the UI thread to check whether transfer is required |
67 // or not. Currently only used in --site-per-process. | 69 // or not. Currently only used in --site-per-process. |
68 bool DeferForNavigationPolicyCheck(ResourceRequestInfoImpl* info, | 70 bool DeferForNavigationPolicyCheck(ResourceRequestInfoImpl* info, |
69 ResourceResponse* response, | 71 ResourceResponse* response, |
70 bool* defer); | 72 bool* defer); |
71 | 73 |
72 bool OnNavigationTransitionResponseStarted(ResourceResponse* response, | 74 bool OnNavigationTransitionResponseStarted( |
73 bool* defer); | 75 ResourceResponse* response, |
| 76 bool* defer, |
| 77 const TransitionLayerData& transition_data); |
74 | 78 |
75 bool OnNormalResponseStarted(ResourceResponse* response, | 79 bool OnNormalResponseStarted(ResourceResponse* response, |
76 bool* defer); | 80 bool* defer); |
77 | 81 |
78 void ResumeOrTransfer(bool is_transfer); | 82 void ResumeOrTransfer(bool is_transfer); |
79 void ResumeIfDeferred(); | 83 void ResumeIfDeferred(); |
80 | 84 |
81 // Called when about to defer a request. Sets |did_defer_| and logs the | 85 // Called when about to defer a request. Sets |did_defer_| and logs the |
82 // defferral | 86 // defferral |
83 void OnDidDefer(); | 87 void OnDidDefer(); |
(...skipping 11 matching lines...) Expand all Loading... |
95 // PostTaskAndReplyWithResult. If a transfer is needed, it goes back to the UI | 99 // PostTaskAndReplyWithResult. If a transfer is needed, it goes back to the UI |
96 // thread. This can be removed once the code is changed to only do one hop. | 100 // thread. This can be removed once the code is changed to only do one hop. |
97 base::WeakPtrFactory<CrossSiteResourceHandler> weak_ptr_factory_; | 101 base::WeakPtrFactory<CrossSiteResourceHandler> weak_ptr_factory_; |
98 | 102 |
99 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); | 103 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); |
100 }; | 104 }; |
101 | 105 |
102 } // namespace content | 106 } // namespace content |
103 | 107 |
104 #endif // CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ | 108 #endif // CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ |
OLD | NEW |