| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // Returns whether a transfer is needed by doing a check on the UI thread. | 89 // Returns whether a transfer is needed by doing a check on the UI thread. |
| 90 CrossSiteResourceHandler::NavigationDecision | 90 CrossSiteResourceHandler::NavigationDecision |
| 91 CheckNavigationPolicyOnUI(GURL real_url, int process_id, int render_frame_id) { | 91 CheckNavigationPolicyOnUI(GURL real_url, int process_id, int render_frame_id) { |
| 92 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); | 92 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); |
| 93 RenderFrameHostImpl* rfh = | 93 RenderFrameHostImpl* rfh = |
| 94 RenderFrameHostImpl::FromID(process_id, render_frame_id); | 94 RenderFrameHostImpl::FromID(process_id, render_frame_id); |
| 95 | 95 |
| 96 // Without a valid RFH against which to check, we must cancel the request, | 96 // Without a valid RFH against which to check, we must cancel the request, |
| 97 // to prevent the resource at |url| from being delivered to a potentially | 97 // to prevent the resource at |url| from being delivered to a potentially |
| 98 // unsuitable renderer process. | 98 // unsuitable renderer process. |
| 99 if (!rfh) | 99 if (!rfh) { |
| 100 CHECK(false); |
| 100 return CrossSiteResourceHandler::NavigationDecision::CANCEL_REQUEST; | 101 return CrossSiteResourceHandler::NavigationDecision::CANCEL_REQUEST; |
| 102 } |
| 101 | 103 |
| 102 RenderFrameHostManager* manager = rfh->frame_tree_node()->render_manager(); | 104 RenderFrameHostManager* manager = rfh->frame_tree_node()->render_manager(); |
| 103 if (manager->IsRendererTransferNeededForNavigation(rfh, real_url)) | 105 if (manager->IsRendererTransferNeededForNavigation(rfh, real_url)) |
| 104 return CrossSiteResourceHandler::NavigationDecision::TRANSFER_REQUIRED; | 106 return CrossSiteResourceHandler::NavigationDecision::TRANSFER_REQUIRED; |
| 105 else | 107 else |
| 106 return CrossSiteResourceHandler::NavigationDecision::USE_EXISTING_RENDERER; | 108 return CrossSiteResourceHandler::NavigationDecision::USE_EXISTING_RENDERER; |
| 107 } | 109 } |
| 108 | 110 |
| 109 } // namespace | 111 } // namespace |
| 110 | 112 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 controller()->Resume(); | 383 controller()->Resume(); |
| 382 } | 384 } |
| 383 } | 385 } |
| 384 | 386 |
| 385 void CrossSiteResourceHandler::OnDidDefer() { | 387 void CrossSiteResourceHandler::OnDidDefer() { |
| 386 did_defer_ = true; | 388 did_defer_ = true; |
| 387 request()->LogBlockedBy("CrossSiteResourceHandler"); | 389 request()->LogBlockedBy("CrossSiteResourceHandler"); |
| 388 } | 390 } |
| 389 | 391 |
| 390 } // namespace content | 392 } // namespace content |
| OLD | NEW |