| 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 <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 | 1033 |
| 1034 GlobalRoutingID id(child_id, route_id); | 1034 GlobalRoutingID id(child_id, route_id); |
| 1035 if (!offline_policy_map_[id]) | 1035 if (!offline_policy_map_[id]) |
| 1036 offline_policy_map_[id] = new OfflinePolicy(); | 1036 offline_policy_map_[id] = new OfflinePolicy(); |
| 1037 load_flags |= offline_policy_map_[id]->GetAdditionalLoadFlags( | 1037 load_flags |= offline_policy_map_[id]->GetAdditionalLoadFlags( |
| 1038 load_flags, request_data.resource_type == ResourceType::MAIN_FRAME); | 1038 load_flags, request_data.resource_type == ResourceType::MAIN_FRAME); |
| 1039 | 1039 |
| 1040 // Construct the request. | 1040 // Construct the request. |
| 1041 scoped_ptr<net::URLRequest> new_request; | 1041 scoped_ptr<net::URLRequest> new_request; |
| 1042 net::URLRequest* request; | 1042 net::URLRequest* request; |
| 1043 new_request.reset(request_context->CreateRequest(request_data.url, NULL)); | 1043 new_request = request_context->CreateRequest( |
| 1044 request_data.url, request_data.priority, NULL); |
| 1044 request = new_request.get(); | 1045 request = new_request.get(); |
| 1045 | 1046 |
| 1046 request->set_method(request_data.method); | 1047 request->set_method(request_data.method); |
| 1047 request->set_first_party_for_cookies(request_data.first_party_for_cookies); | 1048 request->set_first_party_for_cookies(request_data.first_party_for_cookies); |
| 1048 SetReferrerForRequest(request, referrer); | 1049 SetReferrerForRequest(request, referrer); |
| 1049 | 1050 |
| 1050 net::HttpRequestHeaders headers; | 1051 net::HttpRequestHeaders headers; |
| 1051 headers.AddHeadersFromString(request_data.headers); | 1052 headers.AddHeadersFromString(request_data.headers); |
| 1052 request->SetExtraRequestHeaders(headers); | 1053 request->SetExtraRequestHeaders(headers); |
| 1053 | 1054 |
| 1054 request->set_load_flags(load_flags); | 1055 request->set_load_flags(load_flags); |
| 1055 request->SetPriority(request_data.priority); | |
| 1056 | 1056 |
| 1057 // Resolve elements from request_body and prepare upload data. | 1057 // Resolve elements from request_body and prepare upload data. |
| 1058 if (request_data.request_body.get()) { | 1058 if (request_data.request_body.get()) { |
| 1059 webkit_blob::BlobStorageContext* blob_context = NULL; | 1059 webkit_blob::BlobStorageContext* blob_context = NULL; |
| 1060 if (filter_->blob_storage_context()) | 1060 if (filter_->blob_storage_context()) |
| 1061 blob_context = filter_->blob_storage_context()->context(); | 1061 blob_context = filter_->blob_storage_context()->context(); |
| 1062 request->set_upload(UploadDataStreamBuilder::Build( | 1062 request->set_upload(UploadDataStreamBuilder::Build( |
| 1063 request_data.request_body.get(), | 1063 request_data.request_body.get(), |
| 1064 blob_context, | 1064 blob_context, |
| 1065 filter_->file_system_context(), | 1065 filter_->file_system_context(), |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 request_context->job_factory()->IsHandledURL(url); | 1286 request_context->job_factory()->IsHandledURL(url); |
| 1287 if (!known_proto) { | 1287 if (!known_proto) { |
| 1288 // Since any URLs which have non-standard scheme have been filtered | 1288 // Since any URLs which have non-standard scheme have been filtered |
| 1289 // by save manager(see GURL::SchemeIsStandard). This situation | 1289 // by save manager(see GURL::SchemeIsStandard). This situation |
| 1290 // should not happen. | 1290 // should not happen. |
| 1291 NOTREACHED(); | 1291 NOTREACHED(); |
| 1292 return; | 1292 return; |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 scoped_ptr<net::URLRequest> request( | 1295 scoped_ptr<net::URLRequest> request( |
| 1296 request_context->CreateRequest(url, NULL)); | 1296 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); |
| 1297 request->set_method("GET"); | 1297 request->set_method("GET"); |
| 1298 SetReferrerForRequest(request.get(), referrer); | 1298 SetReferrerForRequest(request.get(), referrer); |
| 1299 | 1299 |
| 1300 // So far, for saving page, we need fetch content from cache, in the | 1300 // So far, for saving page, we need fetch content from cache, in the |
| 1301 // future, maybe we can use a configuration to configure this behavior. | 1301 // future, maybe we can use a configuration to configure this behavior. |
| 1302 request->set_load_flags(net::LOAD_PREFERRING_CACHE); | 1302 request->set_load_flags(net::LOAD_PREFERRING_CACHE); |
| 1303 | 1303 |
| 1304 // No need to get offline load flags for save files, but make sure | 1304 // No need to get offline load flags for save files, but make sure |
| 1305 // we have an OfflinePolicy to receive request completions. | 1305 // we have an OfflinePolicy to receive request completions. |
| 1306 GlobalRoutingID id(child_id, route_id); | 1306 GlobalRoutingID id(child_id, route_id); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1930 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
| 1931 && !policy->CanReadRawCookies(child_id)) { | 1931 && !policy->CanReadRawCookies(child_id)) { |
| 1932 VLOG(1) << "Denied unauthorized request for raw headers"; | 1932 VLOG(1) << "Denied unauthorized request for raw headers"; |
| 1933 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 1933 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 return load_flags; | 1936 return load_flags; |
| 1937 } | 1937 } |
| 1938 | 1938 |
| 1939 } // namespace content | 1939 } // namespace content |
| OLD | NEW |