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