| 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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 // Sync loads should have maximum priority and should be the only | 1049 // Sync loads should have maximum priority and should be the only |
| 1050 // requets that have the ignore limits flag set. | 1050 // requets that have the ignore limits flag set. |
| 1051 if (is_sync_load) { | 1051 if (is_sync_load) { |
| 1052 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); | 1052 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); |
| 1053 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); | 1053 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); |
| 1054 } else { | 1054 } else { |
| 1055 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); | 1055 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 // Construct the request. | 1058 // Construct the request. |
| 1059 net::CookieStore* cookie_store = | |
| 1060 GetContentClient()->browser()->OverrideCookieStoreForRenderProcess( | |
| 1061 child_id); | |
| 1062 scoped_ptr<net::URLRequest> new_request; | 1059 scoped_ptr<net::URLRequest> new_request; |
| 1063 new_request = request_context->CreateRequest( | 1060 new_request = request_context->CreateRequest( |
| 1064 request_data.url, request_data.priority, NULL, cookie_store); | 1061 request_data.url, request_data.priority, NULL); |
| 1065 | 1062 |
| 1066 new_request->set_method(request_data.method); | 1063 new_request->set_method(request_data.method); |
| 1067 new_request->set_first_party_for_cookies( | 1064 new_request->set_first_party_for_cookies( |
| 1068 request_data.first_party_for_cookies); | 1065 request_data.first_party_for_cookies); |
| 1069 | 1066 |
| 1070 const Referrer referrer(request_data.referrer, request_data.referrer_policy); | 1067 const Referrer referrer(request_data.referrer, request_data.referrer_policy); |
| 1071 SetReferrerForRequest(new_request.get(), referrer); | 1068 SetReferrerForRequest(new_request.get(), referrer); |
| 1072 | 1069 |
| 1073 net::HttpRequestHeaders headers; | 1070 net::HttpRequestHeaders headers; |
| 1074 headers.AddHeadersFromString(request_data.headers); | 1071 headers.AddHeadersFromString(request_data.headers); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 bool known_proto = | 1352 bool known_proto = |
| 1356 request_context->job_factory()->IsHandledURL(url); | 1353 request_context->job_factory()->IsHandledURL(url); |
| 1357 if (!known_proto) { | 1354 if (!known_proto) { |
| 1358 // Since any URLs which have non-standard scheme have been filtered | 1355 // Since any URLs which have non-standard scheme have been filtered |
| 1359 // by save manager(see GURL::SchemeIsStandard). This situation | 1356 // by save manager(see GURL::SchemeIsStandard). This situation |
| 1360 // should not happen. | 1357 // should not happen. |
| 1361 NOTREACHED(); | 1358 NOTREACHED(); |
| 1362 return; | 1359 return; |
| 1363 } | 1360 } |
| 1364 | 1361 |
| 1365 net::CookieStore* cookie_store = | |
| 1366 GetContentClient()->browser()->OverrideCookieStoreForRenderProcess( | |
| 1367 child_id); | |
| 1368 scoped_ptr<net::URLRequest> request( | 1362 scoped_ptr<net::URLRequest> request( |
| 1369 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL, | 1363 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); |
| 1370 cookie_store)); | |
| 1371 | |
| 1372 request->set_method("GET"); | 1364 request->set_method("GET"); |
| 1373 SetReferrerForRequest(request.get(), referrer); | 1365 SetReferrerForRequest(request.get(), referrer); |
| 1374 | 1366 |
| 1375 // So far, for saving page, we need fetch content from cache, in the | 1367 // So far, for saving page, we need fetch content from cache, in the |
| 1376 // future, maybe we can use a configuration to configure this behavior. | 1368 // future, maybe we can use a configuration to configure this behavior. |
| 1377 request->SetLoadFlags(net::LOAD_PREFERRING_CACHE); | 1369 request->SetLoadFlags(net::LOAD_PREFERRING_CACHE); |
| 1378 | 1370 |
| 1379 // No need to get offline load flags for save files, but make sure | 1371 // No need to get offline load flags for save files, but make sure |
| 1380 // we have an OfflinePolicy to receive request completions. | 1372 // we have an OfflinePolicy to receive request completions. |
| 1381 GlobalRoutingID id(child_id, route_id); | 1373 GlobalRoutingID id(child_id, route_id); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2005 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1997 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
| 2006 && !policy->CanReadRawCookies(child_id)) { | 1998 && !policy->CanReadRawCookies(child_id)) { |
| 2007 VLOG(1) << "Denied unauthorized request for raw headers"; | 1999 VLOG(1) << "Denied unauthorized request for raw headers"; |
| 2008 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 2000 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
| 2009 } | 2001 } |
| 2010 | 2002 |
| 2011 return load_flags; | 2003 return load_flags; |
| 2012 } | 2004 } |
| 2013 | 2005 |
| 2014 } // namespace content | 2006 } // namespace content |
| OLD | NEW |