Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 188693003: Allow the content browser client to specify a special cookie store to be (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 // Sync loads should have maximum priority and should be the only 1050 // Sync loads should have maximum priority and should be the only
1051 // requets that have the ignore limits flag set. 1051 // requets that have the ignore limits flag set.
1052 if (is_sync_load) { 1052 if (is_sync_load) {
1053 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); 1053 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY);
1054 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); 1054 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0);
1055 } else { 1055 } else {
1056 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); 1056 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0);
1057 } 1057 }
1058 1058
1059 // Construct the request. 1059 // Construct the request.
1060 net::CookieStore* cookie_store =
1061 GetContentClient()->browser()->GetSpecialCookieStoreForRenderProcess(
1062 child_id);
1060 scoped_ptr<net::URLRequest> new_request; 1063 scoped_ptr<net::URLRequest> new_request;
1061 new_request = request_context->CreateRequest( 1064 new_request = request_context->CreateRequest(
1062 request_data.url, request_data.priority, NULL); 1065 request_data.url, request_data.priority, NULL, cookie_store);
1063 1066
1064 new_request->set_method(request_data.method); 1067 new_request->set_method(request_data.method);
1065 new_request->set_first_party_for_cookies( 1068 new_request->set_first_party_for_cookies(
1066 request_data.first_party_for_cookies); 1069 request_data.first_party_for_cookies);
1067 1070
1068 const Referrer referrer(request_data.referrer, request_data.referrer_policy); 1071 const Referrer referrer(request_data.referrer, request_data.referrer_policy);
1069 SetReferrerForRequest(new_request.get(), referrer); 1072 SetReferrerForRequest(new_request.get(), referrer);
1070 1073
1071 net::HttpRequestHeaders headers; 1074 net::HttpRequestHeaders headers;
1072 headers.AddHeadersFromString(request_data.headers); 1075 headers.AddHeadersFromString(request_data.headers);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 bool known_proto = 1356 bool known_proto =
1354 request_context->job_factory()->IsHandledURL(url); 1357 request_context->job_factory()->IsHandledURL(url);
1355 if (!known_proto) { 1358 if (!known_proto) {
1356 // Since any URLs which have non-standard scheme have been filtered 1359 // Since any URLs which have non-standard scheme have been filtered
1357 // by save manager(see GURL::SchemeIsStandard). This situation 1360 // by save manager(see GURL::SchemeIsStandard). This situation
1358 // should not happen. 1361 // should not happen.
1359 NOTREACHED(); 1362 NOTREACHED();
1360 return; 1363 return;
1361 } 1364 }
1362 1365
1366 net::CookieStore* cookie_store =
1367 GetContentClient()->browser()->GetSpecialCookieStoreForRenderProcess(
1368 child_id);
1363 scoped_ptr<net::URLRequest> request( 1369 scoped_ptr<net::URLRequest> request(
1364 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); 1370 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL,
1371 cookie_store));
1372
1365 request->set_method("GET"); 1373 request->set_method("GET");
1366 SetReferrerForRequest(request.get(), referrer); 1374 SetReferrerForRequest(request.get(), referrer);
1367 1375
1368 // So far, for saving page, we need fetch content from cache, in the 1376 // So far, for saving page, we need fetch content from cache, in the
1369 // future, maybe we can use a configuration to configure this behavior. 1377 // future, maybe we can use a configuration to configure this behavior.
1370 request->SetLoadFlags(net::LOAD_PREFERRING_CACHE); 1378 request->SetLoadFlags(net::LOAD_PREFERRING_CACHE);
1371 1379
1372 // No need to get offline load flags for save files, but make sure 1380 // No need to get offline load flags for save files, but make sure
1373 // we have an OfflinePolicy to receive request completions. 1381 // we have an OfflinePolicy to receive request completions.
1374 GlobalRoutingID id(child_id, route_id); 1382 GlobalRoutingID id(child_id, route_id);
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) 2006 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS)
1999 && !policy->CanReadRawCookies(child_id)) { 2007 && !policy->CanReadRawCookies(child_id)) {
2000 VLOG(1) << "Denied unauthorized request for raw headers"; 2008 VLOG(1) << "Denied unauthorized request for raw headers";
2001 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; 2009 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS;
2002 } 2010 }
2003 2011
2004 return load_flags; 2012 return load_flags;
2005 } 2013 }
2006 2014
2007 } // namespace content 2015 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698