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 "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "content/browser/appcache/appcache_navigation_handle.h" | 10 #include "content/browser/appcache/appcache_navigation_handle.h" |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 source_site_instance()->GetProcess()->FilterURL(false, &url); | 546 source_site_instance()->GetProcess()->FilterURL(false, &url); |
| 547 // FilterURL sets the URL to about:blank if the CSP checks prevent the | 547 // FilterURL sets the URL to about:blank if the CSP checks prevent the |
| 548 // renderer from accessing it. | 548 // renderer from accessing it. |
| 549 if ((url == url::kAboutBlankURL) && (url != common_params_.url)) { | 549 if ((url == url::kAboutBlankURL) && (url != common_params_.url)) { |
| 550 navigation_handle_->set_net_error_code(net::ERR_ABORTED); | 550 navigation_handle_->set_net_error_code(net::ERR_ABORTED); |
| 551 frame_tree_node_->ResetNavigationRequest(false, true); | 551 frame_tree_node_->ResetNavigationRequest(false, true); |
| 552 return; | 552 return; |
| 553 } | 553 } |
| 554 } | 554 } |
| 555 | 555 |
| 556 // Compute the SiteInstance to use for the redirect and pass its | |
| 557 // RenderProcessHost if it has a process. Keep a reference if it has a | |
| 558 // process, so that the SiteInstance and its associated process aren't deleted | |
| 559 // before the navigation is ready to commit. | |
| 560 scoped_refptr<SiteInstance> site_instance = | |
| 561 frame_tree_node_->render_manager()->GetSiteInstanceForNavigationRequest( | |
| 562 *this); | |
| 563 RenderProcessHost* expected_process = | |
| 564 site_instance->HasProcess() ? site_instance->GetProcess() : nullptr; | |
| 565 speculative_site_instance_ = | |
| 566 site_instance->HasProcess() ? site_instance : nullptr; | |
|
clamy
2017/06/27 16:43:32
Note: I'm not storing the SiteInstance if its proc
Charlie Reis
2017/06/27 18:46:34
Acknowledged.
| |
| 567 | |
| 556 // It's safe to use base::Unretained because this NavigationRequest owns the | 568 // It's safe to use base::Unretained because this NavigationRequest owns the |
| 557 // NavigationHandle where the callback will be stored. | 569 // NavigationHandle where the callback will be stored. |
| 558 bool is_external_protocol = | 570 bool is_external_protocol = |
| 559 !GetContentClient()->browser()->IsHandledURL(common_params_.url); | 571 !GetContentClient()->browser()->IsHandledURL(common_params_.url); |
| 560 navigation_handle_->WillRedirectRequest( | 572 navigation_handle_->WillRedirectRequest( |
| 561 common_params_.url, common_params_.method, common_params_.referrer.url, | 573 common_params_.url, common_params_.method, common_params_.referrer.url, |
| 562 is_external_protocol, response->head.headers, | 574 is_external_protocol, response->head.headers, |
| 563 response->head.connection_info, | 575 response->head.connection_info, expected_process, |
| 564 base::Bind(&NavigationRequest::OnRedirectChecksComplete, | 576 base::Bind(&NavigationRequest::OnRedirectChecksComplete, |
| 565 base::Unretained(this))); | 577 base::Unretained(this))); |
| 566 } | 578 } |
| 567 | 579 |
| 568 void NavigationRequest::OnResponseStarted( | 580 void NavigationRequest::OnResponseStarted( |
| 569 const scoped_refptr<ResourceResponse>& response, | 581 const scoped_refptr<ResourceResponse>& response, |
| 570 std::unique_ptr<StreamHandle> body, | 582 std::unique_ptr<StreamHandle> body, |
| 571 mojo::ScopedDataPipeConsumerHandle consumer_handle, | 583 mojo::ScopedDataPipeConsumerHandle consumer_handle, |
| 572 const SSLStatus& ssl_status, | 584 const SSLStatus& ssl_status, |
| 573 std::unique_ptr<NavigationData> navigation_data, | 585 std::unique_ptr<NavigationData> navigation_data, |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 989 CSPDirective::FrameSrc, common_params_.url, is_redirect, | 1001 CSPDirective::FrameSrc, common_params_.url, is_redirect, |
| 990 common_params_.source_location.value_or(SourceLocation()), | 1002 common_params_.source_location.value_or(SourceLocation()), |
| 991 CSPContext::CHECK_ENFORCED_CSP)) { | 1003 CSPContext::CHECK_ENFORCED_CSP)) { |
| 992 return CONTENT_SECURITY_POLICY_CHECK_PASSED; | 1004 return CONTENT_SECURITY_POLICY_CHECK_PASSED; |
| 993 } | 1005 } |
| 994 | 1006 |
| 995 return CONTENT_SECURITY_POLICY_CHECK_FAILED; | 1007 return CONTENT_SECURITY_POLICY_CHECK_FAILED; |
| 996 } | 1008 } |
| 997 | 1009 |
| 998 } // namespace content | 1010 } // namespace content |
| OLD | NEW |