OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame_host/navigation_request.h" | 5 #include "content/browser/frame_host/navigation_request.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 common_params_.lofi_state = LOFI_ON; | 304 common_params_.lofi_state = LOFI_ON; |
305 else | 305 else |
306 common_params_.lofi_state = LOFI_OFF; | 306 common_params_.lofi_state = LOFI_OFF; |
307 | 307 |
308 // Select an appropriate renderer to commit the navigation. | 308 // Select an appropriate renderer to commit the navigation. |
309 RenderFrameHostImpl* render_frame_host = | 309 RenderFrameHostImpl* render_frame_host = |
310 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); | 310 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); |
311 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, | 311 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, |
312 common_params_.url); | 312 common_params_.url); |
313 | 313 |
| 314 // For renderer-initiated navigations that are set to commit in a different |
| 315 // renderer, allow the embedder to cancel the transfer. |
| 316 if (!browser_initiated_ && |
| 317 render_frame_host != frame_tree_node_->current_frame_host() && |
| 318 !frame_tree_node_->navigator() |
| 319 ->GetDelegate() |
| 320 ->ShouldTransferNavigation()) { |
| 321 frame_tree_node_->ResetNavigationRequest(false); |
| 322 return; |
| 323 } |
| 324 |
314 // Store the response and the StreamHandle until checks have been processed. | 325 // Store the response and the StreamHandle until checks have been processed. |
315 response_ = response; | 326 response_ = response; |
316 body_ = std::move(body); | 327 body_ = std::move(body); |
317 | 328 |
318 // Check if the navigation should be allowed to proceed. | 329 // Check if the navigation should be allowed to proceed. |
319 navigation_handle_->WillProcessResponse( | 330 navigation_handle_->WillProcessResponse( |
320 render_frame_host, response->head.headers.get(), | 331 render_frame_host, response->head.headers.get(), |
321 base::Bind(&NavigationRequest::OnWillProcessResponseChecksComplete, | 332 base::Bind(&NavigationRequest::OnWillProcessResponseChecksComplete, |
322 base::Unretained(this))); | 333 base::Unretained(this))); |
323 } | 334 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 browser_context, navigating_frame_host->GetSiteInstance()); | 454 browser_context, navigating_frame_host->GetSiteInstance()); |
444 DCHECK(partition); | 455 DCHECK(partition); |
445 | 456 |
446 ServiceWorkerContextWrapper* service_worker_context = | 457 ServiceWorkerContextWrapper* service_worker_context = |
447 static_cast<ServiceWorkerContextWrapper*>( | 458 static_cast<ServiceWorkerContextWrapper*>( |
448 partition->GetServiceWorkerContext()); | 459 partition->GetServiceWorkerContext()); |
449 navigation_handle_->InitServiceWorkerHandle(service_worker_context); | 460 navigation_handle_->InitServiceWorkerHandle(service_worker_context); |
450 } | 461 } |
451 | 462 |
452 } // namespace content | 463 } // namespace content |
OLD | NEW |