Chromium Code Reviews| 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/child_process_security_policy_impl.h" | |
| 9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 10 #include "content/browser/frame_host/frame_tree.h" | 11 #include "content/browser/frame_host/frame_tree.h" |
| 11 #include "content/browser/frame_host/frame_tree_node.h" | 12 #include "content/browser/frame_host/frame_tree_node.h" |
| 12 #include "content/browser/frame_host/navigation_controller_impl.h" | 13 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 13 #include "content/browser/frame_host/navigation_handle_impl.h" | 14 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 14 #include "content/browser/frame_host/navigation_request_info.h" | 15 #include "content/browser/frame_host/navigation_request_info.h" |
| 15 #include "content/browser/frame_host/navigator.h" | 16 #include "content/browser/frame_host/navigator.h" |
| 16 #include "content/browser/frame_host/navigator_impl.h" | 17 #include "content/browser/frame_host/navigator_impl.h" |
| 17 #include "content/browser/loader/navigation_url_loader.h" | 18 #include "content/browser/loader/navigation_url_loader.h" |
| 19 #include "content/browser/renderer_host/render_process_host_impl.h" | |
| 18 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 20 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 19 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 21 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
| 20 #include "content/browser/site_instance_impl.h" | 22 #include "content/browser/site_instance_impl.h" |
| 21 #include "content/common/resource_request_body_impl.h" | 23 #include "content/common/resource_request_body_impl.h" |
| 22 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
| 23 #include "content/public/browser/content_browser_client.h" | 25 #include "content/public/browser/content_browser_client.h" |
| 24 #include "content/public/browser/navigation_controller.h" | 26 #include "content/public/browser/navigation_controller.h" |
| 25 #include "content/public/browser/navigation_data.h" | 27 #include "content/public/browser/navigation_data.h" |
| 26 #include "content/public/browser/navigation_ui_data.h" | 28 #include "content/public/browser/navigation_ui_data.h" |
| 27 #include "content/public/browser/storage_partition.h" | 29 #include "content/public/browser/storage_partition.h" |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 frame_tree_node_->frame_tree_node_id()), | 508 frame_tree_node_->frame_tree_node_id()), |
| 507 std::move(navigation_ui_data), | 509 std::move(navigation_ui_data), |
| 508 navigation_handle_->service_worker_handle(), this); | 510 navigation_handle_->service_worker_handle(), this); |
| 509 } | 511 } |
| 510 | 512 |
| 511 void NavigationRequest::OnRedirectChecksComplete( | 513 void NavigationRequest::OnRedirectChecksComplete( |
| 512 NavigationThrottle::ThrottleCheckResult result) { | 514 NavigationThrottle::ThrottleCheckResult result) { |
| 513 CHECK(result != NavigationThrottle::DEFER); | 515 CHECK(result != NavigationThrottle::DEFER); |
| 514 | 516 |
| 515 // Abort the request if needed. This will destroy the NavigationRequest. | 517 // Abort the request if needed. This will destroy the NavigationRequest. |
| 518 // For non browser initiated navigations we need to check if the renderer | |
| 519 // process associated with the SiteInstance has access to the URL. | |
| 516 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 520 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
| 517 result == NavigationThrottle::CANCEL) { | 521 result == NavigationThrottle::CANCEL || |
| 522 (!browser_initiated_ && | |
|
Charlie Reis
2016/10/21 23:01:43
nit: Would be clearer to move this complex conditi
ananta
2016/10/22 00:20:42
Done.
| |
| 523 !ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( | |
| 524 frame_tree_node()->current_frame_host()->GetSiteInstance()-> | |
|
Charlie Reis
2016/10/21 23:01:44
This looks incorrect to me in the case that anothe
ananta
2016/10/22 00:20:42
Added a check for both source and target site inst
| |
| 525 GetProcess()->GetID(), | |
| 526 common_params_.url))) { | |
| 518 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 527 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
| 519 frame_tree_node_->ResetNavigationRequest(false); | 528 frame_tree_node_->ResetNavigationRequest(false); |
| 520 return; | 529 return; |
| 521 } | 530 } |
| 522 | 531 |
| 523 loader_->FollowRedirect(); | 532 loader_->FollowRedirect(); |
| 524 } | 533 } |
| 525 | 534 |
| 526 void NavigationRequest::OnWillProcessResponseChecksComplete( | 535 void NavigationRequest::OnWillProcessResponseChecksComplete( |
| 527 NavigationThrottle::ThrottleCheckResult result) { | 536 NavigationThrottle::ThrottleCheckResult result) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 570 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 562 | 571 |
| 563 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 572 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 564 common_params_, request_params_, | 573 common_params_, request_params_, |
| 565 is_view_source_); | 574 is_view_source_); |
| 566 | 575 |
| 567 frame_tree_node_->ResetNavigationRequest(true); | 576 frame_tree_node_->ResetNavigationRequest(true); |
| 568 } | 577 } |
| 569 | 578 |
| 570 } // namespace content | 579 } // namespace content |
| OLD | NEW |