| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // We can now send the response to the new renderer, which will cause | 43 // We can now send the response to the new renderer, which will cause |
| 44 // WebContentsImpl to swap in the new renderer and destroy the old one. | 44 // WebContentsImpl to swap in the new renderer and destroy the old one. |
| 45 void ResumeResponse(); | 45 void ResumeResponse(); |
| 46 | 46 |
| 47 // When set to true, requests are leaked when they can't be passed to a | 47 // When set to true, requests are leaked when they can't be passed to a |
| 48 // RenderViewHost, for unit tests. | 48 // RenderViewHost, for unit tests. |
| 49 CONTENT_EXPORT static void SetLeakRequestsForTesting( | 49 CONTENT_EXPORT static void SetLeakRequestsForTesting( |
| 50 bool leak_requests_for_testing); | 50 bool leak_requests_for_testing); |
| 51 | 51 |
| 52 // Navigations are deferred at OnResponseStarted to parse out any navigation | |
| 53 // transition link headers, and give the navigation transition (if it exists) | |
| 54 // a chance to run. | |
| 55 void ResumeResponseDeferredAtStart(int request_id); | |
| 56 | |
| 57 // Returns whether the handler is deferred. | 52 // Returns whether the handler is deferred. |
| 58 bool did_defer_for_testing() const { return did_defer_; } | 53 bool did_defer_for_testing() const { return did_defer_; } |
| 59 | 54 |
| 60 private: | 55 private: |
| 61 // Prepare to transfer the cross-site response to a new RenderFrameHost, by | 56 // Prepare to transfer the cross-site response to a new RenderFrameHost, by |
| 62 // asking it to issue an identical request (on the UI thread). | 57 // asking it to issue an identical request (on the UI thread). |
| 63 void StartCrossSiteTransition(ResourceResponse* response); | 58 void StartCrossSiteTransition(ResourceResponse* response); |
| 64 | 59 |
| 65 // Defer the navigation to the UI thread to check whether transfer is required | 60 // Defer the navigation to the UI thread to check whether transfer is required |
| 66 // or not. Currently only used in --site-per-process. | 61 // or not. Currently only used in --site-per-process. |
| 67 bool DeferForNavigationPolicyCheck(ResourceRequestInfoImpl* info, | 62 bool DeferForNavigationPolicyCheck(ResourceRequestInfoImpl* info, |
| 68 ResourceResponse* response, | 63 ResourceResponse* response, |
| 69 bool* defer); | 64 bool* defer); |
| 70 | 65 |
| 71 bool OnNavigationTransitionResponseStarted( | |
| 72 ResourceResponse* response, | |
| 73 bool* defer, | |
| 74 const TransitionLayerData& transition_data); | |
| 75 | |
| 76 bool OnNormalResponseStarted(ResourceResponse* response, | 66 bool OnNormalResponseStarted(ResourceResponse* response, |
| 77 bool* defer); | 67 bool* defer); |
| 78 | 68 |
| 79 void ResumeOrTransfer(bool is_transfer); | 69 void ResumeOrTransfer(bool is_transfer); |
| 80 void ResumeIfDeferred(); | 70 void ResumeIfDeferred(); |
| 81 | 71 |
| 82 // Called when about to defer a request. Sets |did_defer_| and logs the | 72 // Called when about to defer a request. Sets |did_defer_| and logs the |
| 83 // defferral | 73 // defferral |
| 84 void OnDidDefer(); | 74 void OnDidDefer(); |
| 85 | 75 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 96 // PostTaskAndReplyWithResult. If a transfer is needed, it goes back to the UI | 86 // PostTaskAndReplyWithResult. If a transfer is needed, it goes back to the UI |
| 97 // thread. This can be removed once the code is changed to only do one hop. | 87 // thread. This can be removed once the code is changed to only do one hop. |
| 98 base::WeakPtrFactory<CrossSiteResourceHandler> weak_ptr_factory_; | 88 base::WeakPtrFactory<CrossSiteResourceHandler> weak_ptr_factory_; |
| 99 | 89 |
| 100 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); | 90 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); |
| 101 }; | 91 }; |
| 102 | 92 |
| 103 } // namespace content | 93 } // namespace content |
| 104 | 94 |
| 105 #endif // CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ | 95 #endif // CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ |
| OLD | NEW |