| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( | 1866 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( |
| 1867 net::URLRequest* request) { | 1867 net::URLRequest* request) { |
| 1868 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 1868 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
| 1869 IncrementOutstandingRequestsCount(-1, info); | 1869 IncrementOutstandingRequestsCount(-1, info); |
| 1870 } | 1870 } |
| 1871 | 1871 |
| 1872 void ResourceDispatcherHostImpl::BeginNavigationRequest( | 1872 void ResourceDispatcherHostImpl::BeginNavigationRequest( |
| 1873 ResourceContext* resource_context, | 1873 ResourceContext* resource_context, |
| 1874 int frame_tree_node_id, | 1874 int frame_tree_node_id, |
| 1875 const NavigationRequestInfo& info, | 1875 const NavigationRequestInfo& info, |
| 1876 NavigationURLLoaderImplCore* loader) { | 1876 NavigationURLLoaderImplCore* loader, |
| 1877 ServiceWorkerContextWrapper* service_worker_context) { |
| 1877 // PlzNavigate: BeginNavigationRequest currently should only be used for the | 1878 // PlzNavigate: BeginNavigationRequest currently should only be used for the |
| 1878 // browser-side navigations project. | 1879 // browser-side navigations project. |
| 1879 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 1880 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1880 switches::kEnableBrowserSideNavigation)); | 1881 switches::kEnableBrowserSideNavigation)); |
| 1881 | 1882 |
| 1882 ResourceType resource_type = info.is_main_frame ? | 1883 ResourceType resource_type = info.is_main_frame ? |
| 1883 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; | 1884 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; |
| 1884 | 1885 |
| 1885 if (is_shutdown_ || | 1886 if (is_shutdown_ || |
| 1886 // TODO(davidben): Check ShouldServiceRequest here. This is important; it | 1887 // TODO(davidben): Check ShouldServiceRequest here. This is important; it |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 } | 1932 } |
| 1932 | 1933 |
| 1933 SetReferrerForRequest(new_request.get(), info.common_params.referrer); | 1934 SetReferrerForRequest(new_request.get(), info.common_params.referrer); |
| 1934 | 1935 |
| 1935 net::HttpRequestHeaders headers; | 1936 net::HttpRequestHeaders headers; |
| 1936 headers.AddHeadersFromString(info.begin_params.headers); | 1937 headers.AddHeadersFromString(info.begin_params.headers); |
| 1937 new_request->SetExtraRequestHeaders(headers); | 1938 new_request->SetExtraRequestHeaders(headers); |
| 1938 | 1939 |
| 1939 new_request->SetLoadFlags(load_flags); | 1940 new_request->SetLoadFlags(load_flags); |
| 1940 | 1941 |
| 1942 storage::BlobStorageContext* blob_context = GetBlobStorageContext( |
| 1943 GetChromeBlobStorageContextForResourceContext(resource_context)); |
| 1941 // Resolve elements from request_body and prepare upload data. | 1944 // Resolve elements from request_body and prepare upload data. |
| 1942 if (info.request_body.get()) { | 1945 if (info.request_body.get()) { |
| 1943 storage::BlobStorageContext* blob_context = GetBlobStorageContext( | |
| 1944 GetChromeBlobStorageContextForResourceContext(resource_context)); | |
| 1945 AttachRequestBodyBlobDataHandles( | 1946 AttachRequestBodyBlobDataHandles( |
| 1946 info.request_body.get(), | 1947 info.request_body.get(), |
| 1947 blob_context); | 1948 blob_context); |
| 1948 // TODO(davidben): The FileSystemContext is null here. In the case where | 1949 // TODO(davidben): The FileSystemContext is null here. In the case where |
| 1949 // another renderer requested this navigation, this should be the same | 1950 // another renderer requested this navigation, this should be the same |
| 1950 // FileSystemContext passed into ShouldServiceRequest. | 1951 // FileSystemContext passed into ShouldServiceRequest. |
| 1951 new_request->set_upload(UploadDataStreamBuilder::Build( | 1952 new_request->set_upload(UploadDataStreamBuilder::Build( |
| 1952 info.request_body.get(), | 1953 info.request_body.get(), |
| 1953 blob_context, | 1954 blob_context, |
| 1954 nullptr, // file_system_context | 1955 nullptr, // file_system_context |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1999 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 2000 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
| 2000 // Hang on to a reference to ensure the blob is not released prior | 2001 // Hang on to a reference to ensure the blob is not released prior |
| 2001 // to the job being started. | 2002 // to the job being started. |
| 2002 ChromeBlobStorageContext* blob_context = | 2003 ChromeBlobStorageContext* blob_context = |
| 2003 GetChromeBlobStorageContextForResourceContext(resource_context); | 2004 GetChromeBlobStorageContextForResourceContext(resource_context); |
| 2004 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 2005 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
| 2005 new_request.get(), | 2006 new_request.get(), |
| 2006 blob_context->context()->GetBlobDataFromPublicURL(new_request->url())); | 2007 blob_context->context()->GetBlobDataFromPublicURL(new_request->url())); |
| 2007 } | 2008 } |
| 2008 | 2009 |
| 2010 ServiceWorkerRequestHandler::InitializeNavigationHandler( |
| 2011 new_request.get(), service_worker_context, blob_context, |
| 2012 false, // TODO(horo): Add skip_service_worker to NavigationRequestInfo. |
| 2013 info.is_main_frame, // RESOURCE_TYPE_MAIN_FRAME or |
| 2014 // RESOURCE_TYPE_SUB_FRAME |
| 2015 info.request_body, loader); |
| 2016 |
| 2009 // TODO(davidben): Attach ServiceWorkerRequestHandler. | 2017 // TODO(davidben): Attach ServiceWorkerRequestHandler. |
| 2010 // TODO(michaeln): Help out with this and that. | 2018 // TODO(michaeln): Help out with this and that. |
| 2011 // TODO(davidben): Attach AppCacheInterceptor. | 2019 // TODO(davidben): Attach AppCacheInterceptor. |
| 2012 | 2020 |
| 2013 scoped_ptr<ResourceHandler> handler(new NavigationResourceHandler( | 2021 scoped_ptr<ResourceHandler> handler(new NavigationResourceHandler( |
| 2014 new_request.get(), loader)); | 2022 new_request.get(), loader)); |
| 2015 | 2023 |
| 2016 // TODO(davidben): Pass in the appropriate appcache_service. Also fix the | 2024 // TODO(davidben): Pass in the appropriate appcache_service. Also fix the |
| 2017 // dependency on child_id/route_id. Those are used by the ResourceScheduler; | 2025 // dependency on child_id/route_id. Those are used by the ResourceScheduler; |
| 2018 // currently it's a no-op. | 2026 // currently it's a no-op. |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 2360 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
| 2353 && !policy->CanReadRawCookies(child_id)) { | 2361 && !policy->CanReadRawCookies(child_id)) { |
| 2354 VLOG(1) << "Denied unauthorized request for raw headers"; | 2362 VLOG(1) << "Denied unauthorized request for raw headers"; |
| 2355 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 2363 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
| 2356 } | 2364 } |
| 2357 | 2365 |
| 2358 return load_flags; | 2366 return load_flags; |
| 2359 } | 2367 } |
| 2360 | 2368 |
| 2361 } // namespace content | 2369 } // namespace content |
| OLD | NEW |