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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 if (!web_contents) | 303 if (!web_contents) |
304 return; | 304 return; |
305 web_contents->DidGetResourceResponseStart(*details.get()); | 305 web_contents->DidGetResourceResponseStart(*details.get()); |
306 } | 306 } |
307 | 307 |
308 bool IsValidatedSCT( | 308 bool IsValidatedSCT( |
309 const net::SignedCertificateTimestampAndStatus& sct_status) { | 309 const net::SignedCertificateTimestampAndStatus& sct_status) { |
310 return sct_status.status == net::ct::SCT_STATUS_OK; | 310 return sct_status.status == net::ct::SCT_STATUS_OK; |
311 } | 311 } |
312 | 312 |
| 313 webkit_blob::BlobStorageContext* GetBlobStorageContext( |
| 314 ResourceMessageFilter* filter) { |
| 315 if (!filter->blob_storage_context()) |
| 316 return NULL; |
| 317 return filter->blob_storage_context()->context(); |
| 318 } |
| 319 |
313 } // namespace | 320 } // namespace |
314 | 321 |
315 // static | 322 // static |
316 ResourceDispatcherHost* ResourceDispatcherHost::Get() { | 323 ResourceDispatcherHost* ResourceDispatcherHost::Get() { |
317 return g_resource_dispatcher_host; | 324 return g_resource_dispatcher_host; |
318 } | 325 } |
319 | 326 |
320 ResourceDispatcherHostImpl::ResourceDispatcherHostImpl() | 327 ResourceDispatcherHostImpl::ResourceDispatcherHostImpl() |
321 : save_file_manager_(new SaveFileManager()), | 328 : save_file_manager_(new SaveFileManager()), |
322 request_id_(-1), | 329 request_id_(-1), |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 SetReferrerForRequest(new_request.get(), referrer); | 1050 SetReferrerForRequest(new_request.get(), referrer); |
1044 | 1051 |
1045 net::HttpRequestHeaders headers; | 1052 net::HttpRequestHeaders headers; |
1046 headers.AddHeadersFromString(request_data.headers); | 1053 headers.AddHeadersFromString(request_data.headers); |
1047 new_request->SetExtraRequestHeaders(headers); | 1054 new_request->SetExtraRequestHeaders(headers); |
1048 | 1055 |
1049 new_request->SetLoadFlags(load_flags); | 1056 new_request->SetLoadFlags(load_flags); |
1050 | 1057 |
1051 // Resolve elements from request_body and prepare upload data. | 1058 // Resolve elements from request_body and prepare upload data. |
1052 if (request_data.request_body.get()) { | 1059 if (request_data.request_body.get()) { |
1053 webkit_blob::BlobStorageContext* blob_context = NULL; | |
1054 if (filter_->blob_storage_context()) | |
1055 blob_context = filter_->blob_storage_context()->context(); | |
1056 new_request->set_upload(UploadDataStreamBuilder::Build( | 1060 new_request->set_upload(UploadDataStreamBuilder::Build( |
1057 request_data.request_body.get(), | 1061 request_data.request_body.get(), |
1058 blob_context, | 1062 GetBlobStorageContext(filter_), |
1059 filter_->file_system_context(), | 1063 filter_->file_system_context(), |
1060 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) | 1064 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) |
1061 .get())); | 1065 .get())); |
1062 } | 1066 } |
1063 | 1067 |
1064 bool allow_download = request_data.allow_download && | 1068 bool allow_download = request_data.allow_download && |
1065 ResourceType::IsFrame(request_data.resource_type); | 1069 ResourceType::IsFrame(request_data.resource_type); |
1066 | 1070 |
1067 // Make extra info and read footer (contains request ID). | 1071 // Make extra info and read footer (contains request ID). |
1068 ResourceRequestInfoImpl* extra_info = | 1072 ResourceRequestInfoImpl* extra_info = |
(...skipping 28 matching lines...) Expand all Loading... |
1097 webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle( | 1101 webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle( |
1098 new_request.get(), | 1102 new_request.get(), |
1099 filter_->blob_storage_context()->context()-> | 1103 filter_->blob_storage_context()->context()-> |
1100 GetBlobDataFromPublicURL(new_request->url())); | 1104 GetBlobDataFromPublicURL(new_request->url())); |
1101 } | 1105 } |
1102 | 1106 |
1103 // Initialize the service worker handler for the request. | 1107 // Initialize the service worker handler for the request. |
1104 ServiceWorkerRequestHandler::InitializeHandler( | 1108 ServiceWorkerRequestHandler::InitializeHandler( |
1105 new_request.get(), | 1109 new_request.get(), |
1106 filter_->service_worker_context(), | 1110 filter_->service_worker_context(), |
| 1111 GetBlobStorageContext(filter_), |
1107 child_id, | 1112 child_id, |
1108 request_data.service_worker_provider_id, | 1113 request_data.service_worker_provider_id, |
1109 request_data.resource_type); | 1114 request_data.resource_type); |
1110 | 1115 |
1111 // Have the appcache associate its extra info with the request. | 1116 // Have the appcache associate its extra info with the request. |
1112 AppCacheInterceptor::SetExtraRequestInfo( | 1117 AppCacheInterceptor::SetExtraRequestInfo( |
1113 new_request.get(), filter_->appcache_service(), child_id, | 1118 new_request.get(), filter_->appcache_service(), child_id, |
1114 request_data.appcache_host_id, request_data.resource_type); | 1119 request_data.appcache_host_id, request_data.resource_type); |
1115 | 1120 |
1116 scoped_ptr<ResourceHandler> handler( | 1121 scoped_ptr<ResourceHandler> handler( |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1977 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
1973 && !policy->CanReadRawCookies(child_id)) { | 1978 && !policy->CanReadRawCookies(child_id)) { |
1974 VLOG(1) << "Denied unauthorized request for raw headers"; | 1979 VLOG(1) << "Denied unauthorized request for raw headers"; |
1975 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 1980 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
1976 } | 1981 } |
1977 | 1982 |
1978 return load_flags; | 1983 return load_flags; |
1979 } | 1984 } |
1980 | 1985 |
1981 } // namespace content | 1986 } // namespace content |
OLD | NEW |