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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading |
6 | 6 |
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
571 if (!delegate_) | 571 if (!delegate_) |
572 return false; | 572 return false; |
573 | 573 |
574 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); | 574 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); |
575 | 575 |
576 if (!IsResourceTypeFrame(info->GetResourceType())) | 576 if (!IsResourceTypeFrame(info->GetResourceType())) |
577 return false; | 577 return false; |
578 | 578 |
579 const net::URLRequestJobFactory* job_factory = | 579 const net::URLRequestJobFactory* job_factory = |
580 info->GetContext()->GetRequestContext()->job_factory(); | 580 info->GetContext()->GetRequestContext()->job_factory(); |
581 if (job_factory->IsHandledURL(url)) | 581 if (!url.is_valid() || job_factory->IsHandledProtocol(url.scheme())) |
mmenke
2017/03/31 04:30:04
I hope to remove the calls when moving launching p
asanka
2017/03/31 20:38:30
Acknowledged.
| |
582 return false; | 582 return false; |
583 | 583 |
584 return delegate_->HandleExternalProtocol(url, info); | 584 return delegate_->HandleExternalProtocol(url, info); |
585 } | 585 } |
586 | 586 |
587 void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) { | 587 void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) { |
588 // Make sure we have the load state monitor running. | 588 // Make sure we have the load state monitor running. |
589 if (!update_load_states_timer_->IsRunning() && | 589 if (!update_load_states_timer_->IsRunning() && |
590 scheduler_->HasLoadingClients()) { | 590 scheduler_->HasLoadingClients()) { |
591 update_load_states_timer_->Start( | 591 update_load_states_timer_->Start( |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1928 ResourceType resource_type = info.is_main_frame ? | 1928 ResourceType resource_type = info.is_main_frame ? |
1929 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; | 1929 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; |
1930 | 1930 |
1931 // Do not allow browser plugin guests to navigate to non-web URLs, since they | 1931 // Do not allow browser plugin guests to navigate to non-web URLs, since they |
1932 // cannot swap processes or grant bindings. Do not check external protocols | 1932 // cannot swap processes or grant bindings. Do not check external protocols |
1933 // here because they're checked in | 1933 // here because they're checked in |
1934 // ChromeResourceDispatcherHostDelegate::HandleExternalProtocol. | 1934 // ChromeResourceDispatcherHostDelegate::HandleExternalProtocol. |
1935 ChildProcessSecurityPolicyImpl* policy = | 1935 ChildProcessSecurityPolicyImpl* policy = |
1936 ChildProcessSecurityPolicyImpl::GetInstance(); | 1936 ChildProcessSecurityPolicyImpl::GetInstance(); |
1937 bool is_external_protocol = | 1937 bool is_external_protocol = |
1938 !resource_context->GetRequestContext()->job_factory()->IsHandledURL( | 1938 info.common_params.url.is_valid() && |
1939 info.common_params.url); | 1939 !resource_context->GetRequestContext()->job_factory()->IsHandledProtocol( |
1940 info.common_params.url.scheme()); | |
1940 bool non_web_url_in_guest = | 1941 bool non_web_url_in_guest = |
1941 info.is_for_guests_only && | 1942 info.is_for_guests_only && |
1942 !policy->IsWebSafeScheme(info.common_params.url.scheme()) && | 1943 !policy->IsWebSafeScheme(info.common_params.url.scheme()) && |
1943 !is_external_protocol; | 1944 !is_external_protocol; |
1944 | 1945 |
1945 if (is_shutdown_ || non_web_url_in_guest || | 1946 if (is_shutdown_ || non_web_url_in_guest || |
1946 // TODO(davidben): Check ShouldServiceRequest here. This is important; it | 1947 // TODO(davidben): Check ShouldServiceRequest here. This is important; it |
1947 // needs to be checked relative to the child that /requested/ the | 1948 // needs to be checked relative to the child that /requested/ the |
1948 // navigation. It's where file upload checks, etc., come in. | 1949 // navigation. It's where file upload checks, etc., come in. |
1949 (delegate_ && !delegate_->ShouldBeginRequest( | 1950 (delegate_ && !delegate_->ShouldBeginRequest( |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2613 &throttles); | 2614 &throttles); |
2614 if (!throttles.empty()) { | 2615 if (!throttles.empty()) { |
2615 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2616 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2616 std::move(throttles))); | 2617 std::move(throttles))); |
2617 } | 2618 } |
2618 } | 2619 } |
2619 return handler; | 2620 return handler; |
2620 } | 2621 } |
2621 | 2622 |
2622 } // namespace content | 2623 } // namespace content |
OLD | NEW |