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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 | 1020 |
1021 GlobalRoutingID id(child_id, route_id); | 1021 GlobalRoutingID id(child_id, route_id); |
1022 if (!offline_policy_map_[id]) | 1022 if (!offline_policy_map_[id]) |
1023 offline_policy_map_[id] = new OfflinePolicy(); | 1023 offline_policy_map_[id] = new OfflinePolicy(); |
1024 load_flags |= offline_policy_map_[id]->GetAdditionalLoadFlags( | 1024 load_flags |= offline_policy_map_[id]->GetAdditionalLoadFlags( |
1025 load_flags, request_data.resource_type == ResourceType::MAIN_FRAME); | 1025 load_flags, request_data.resource_type == ResourceType::MAIN_FRAME); |
1026 | 1026 |
1027 // Construct the request. | 1027 // Construct the request. |
1028 scoped_ptr<net::URLRequest> new_request; | 1028 scoped_ptr<net::URLRequest> new_request; |
1029 net::URLRequest* request; | 1029 net::URLRequest* request; |
1030 new_request.reset(request_context->CreateRequest(request_data.url, NULL)); | 1030 new_request.reset(request_context->CreateRequest( |
| 1031 request_data.url, request_data.priority, NULL)); |
1031 request = new_request.get(); | 1032 request = new_request.get(); |
1032 | 1033 |
1033 request->set_method(request_data.method); | 1034 request->set_method(request_data.method); |
1034 request->set_first_party_for_cookies(request_data.first_party_for_cookies); | 1035 request->set_first_party_for_cookies(request_data.first_party_for_cookies); |
1035 SetReferrerForRequest(request, referrer); | 1036 SetReferrerForRequest(request, referrer); |
1036 | 1037 |
1037 net::HttpRequestHeaders headers; | 1038 net::HttpRequestHeaders headers; |
1038 headers.AddHeadersFromString(request_data.headers); | 1039 headers.AddHeadersFromString(request_data.headers); |
1039 request->SetExtraRequestHeaders(headers); | 1040 request->SetExtraRequestHeaders(headers); |
1040 | 1041 |
1041 request->set_load_flags(load_flags); | 1042 request->set_load_flags(load_flags); |
1042 request->SetPriority(request_data.priority); | |
1043 | 1043 |
1044 // Resolve elements from request_body and prepare upload data. | 1044 // Resolve elements from request_body and prepare upload data. |
1045 if (request_data.request_body.get()) { | 1045 if (request_data.request_body.get()) { |
1046 webkit_blob::BlobStorageContext* blob_context = NULL; | 1046 webkit_blob::BlobStorageContext* blob_context = NULL; |
1047 if (filter_->blob_storage_context()) | 1047 if (filter_->blob_storage_context()) |
1048 blob_context = filter_->blob_storage_context()->context(); | 1048 blob_context = filter_->blob_storage_context()->context(); |
1049 request->set_upload(UploadDataStreamBuilder::Build( | 1049 request->set_upload(UploadDataStreamBuilder::Build( |
1050 request_data.request_body.get(), | 1050 request_data.request_body.get(), |
1051 blob_context, | 1051 blob_context, |
1052 filter_->file_system_context(), | 1052 filter_->file_system_context(), |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 request_context->job_factory()->IsHandledURL(url); | 1269 request_context->job_factory()->IsHandledURL(url); |
1270 if (!known_proto) { | 1270 if (!known_proto) { |
1271 // Since any URLs which have non-standard scheme have been filtered | 1271 // Since any URLs which have non-standard scheme have been filtered |
1272 // by save manager(see GURL::SchemeIsStandard). This situation | 1272 // by save manager(see GURL::SchemeIsStandard). This situation |
1273 // should not happen. | 1273 // should not happen. |
1274 NOTREACHED(); | 1274 NOTREACHED(); |
1275 return; | 1275 return; |
1276 } | 1276 } |
1277 | 1277 |
1278 scoped_ptr<net::URLRequest> request( | 1278 scoped_ptr<net::URLRequest> request( |
1279 request_context->CreateRequest(url, NULL)); | 1279 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); |
1280 request->set_method("GET"); | 1280 request->set_method("GET"); |
1281 SetReferrerForRequest(request.get(), referrer); | 1281 SetReferrerForRequest(request.get(), referrer); |
1282 | 1282 |
1283 // So far, for saving page, we need fetch content from cache, in the | 1283 // So far, for saving page, we need fetch content from cache, in the |
1284 // future, maybe we can use a configuration to configure this behavior. | 1284 // future, maybe we can use a configuration to configure this behavior. |
1285 request->set_load_flags(net::LOAD_PREFERRING_CACHE); | 1285 request->set_load_flags(net::LOAD_PREFERRING_CACHE); |
1286 | 1286 |
1287 // No need to get offline load flags for save files, but make sure | 1287 // No need to get offline load flags for save files, but make sure |
1288 // we have an OfflinePolicy to receive request completions. | 1288 // we have an OfflinePolicy to receive request completions. |
1289 GlobalRoutingID id(child_id, route_id); | 1289 GlobalRoutingID id(child_id, route_id); |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1912 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
1913 && !policy->CanReadRawCookies(child_id)) { | 1913 && !policy->CanReadRawCookies(child_id)) { |
1914 VLOG(1) << "Denied unauthorized request for raw headers"; | 1914 VLOG(1) << "Denied unauthorized request for raw headers"; |
1915 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 1915 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
1916 } | 1916 } |
1917 | 1917 |
1918 return load_flags; | 1918 return load_flags; |
1919 } | 1919 } |
1920 | 1920 |
1921 } // namespace content | 1921 } // namespace content |
OLD | NEW |