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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. |
516 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 518 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
517 result == NavigationThrottle::CANCEL) { | 519 result == NavigationThrottle::CANCEL || |
| 520 !ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( |
| 521 frame_tree_node()->current_frame_host()->GetProcess()->GetID(), |
| 522 common_params_.url)) { |
518 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 523 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
519 frame_tree_node_->ResetNavigationRequest(false); | 524 frame_tree_node_->ResetNavigationRequest(false); |
520 return; | 525 return; |
521 } | 526 } |
522 | 527 |
523 loader_->FollowRedirect(); | 528 loader_->FollowRedirect(); |
524 } | 529 } |
525 | 530 |
526 void NavigationRequest::OnWillProcessResponseChecksComplete( | 531 void NavigationRequest::OnWillProcessResponseChecksComplete( |
527 NavigationThrottle::ThrottleCheckResult result) { | 532 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); | 566 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
562 | 567 |
563 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 568 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
564 common_params_, request_params_, | 569 common_params_, request_params_, |
565 is_view_source_); | 570 is_view_source_); |
566 | 571 |
567 frame_tree_node_->ResetNavigationRequest(true); | 572 frame_tree_node_->ResetNavigationRequest(true); |
568 } | 573 } |
569 | 574 |
570 } // namespace content | 575 } // namespace content |
OLD | NEW |