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 #include "content/browser/loader/cross_site_resource_handler.h" | 5 #include "content/browser/loader/cross_site_resource_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 }; | 61 }; |
62 | 62 |
63 void OnCrossSiteResponseHelper(const CrossSiteResponseParams& params) { | 63 void OnCrossSiteResponseHelper(const CrossSiteResponseParams& params) { |
64 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request( | 64 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request( |
65 new CrossSiteTransferringRequest(params.global_request_id)); | 65 new CrossSiteTransferringRequest(params.global_request_id)); |
66 | 66 |
67 RenderFrameHostImpl* rfh = | 67 RenderFrameHostImpl* rfh = |
68 RenderFrameHostImpl::FromID(params.global_request_id.child_id, | 68 RenderFrameHostImpl::FromID(params.global_request_id.child_id, |
69 params.render_frame_id); | 69 params.render_frame_id); |
70 if (rfh) { | 70 if (rfh) { |
| 71 if (rfh->GetParent()) { |
| 72 // We should only swap processes for subframes in --site-per-process mode. |
| 73 // CrossSiteResourceHandler is not installed on subframe requests in |
| 74 // default Chrome. |
| 75 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 76 switches::kSitePerProcess)); |
| 77 } |
71 rfh->OnCrossSiteResponse( | 78 rfh->OnCrossSiteResponse( |
72 params.global_request_id, cross_site_transferring_request.Pass(), | 79 params.global_request_id, cross_site_transferring_request.Pass(), |
73 params.transfer_url_chain, params.referrer, | 80 params.transfer_url_chain, params.referrer, |
74 params.page_transition, params.should_replace_current_entry); | 81 params.page_transition, params.should_replace_current_entry); |
75 } else if (leak_requests_for_testing_ && cross_site_transferring_request) { | 82 } else if (leak_requests_for_testing_ && cross_site_transferring_request) { |
76 // Some unit tests expect requests to be leaked in this case, so they can | 83 // Some unit tests expect requests to be leaked in this case, so they can |
77 // pass them along manually. | 84 // pass them along manually. |
78 cross_site_transferring_request->ReleaseRequest(); | 85 cross_site_transferring_request->ReleaseRequest(); |
79 } | 86 } |
80 } | 87 } |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 controller()->Resume(); | 429 controller()->Resume(); |
423 } | 430 } |
424 } | 431 } |
425 | 432 |
426 void CrossSiteResourceHandler::OnDidDefer() { | 433 void CrossSiteResourceHandler::OnDidDefer() { |
427 did_defer_ = true; | 434 did_defer_ = true; |
428 request()->LogBlockedBy("CrossSiteResourceHandler"); | 435 request()->LogBlockedBy("CrossSiteResourceHandler"); |
429 } | 436 } |
430 | 437 |
431 } // namespace content | 438 } // namespace content |
OLD | NEW |