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

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

Issue 398903002: Plumb redirect info out of net, through content, and into child processes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: darin comments Created 6 years, 4 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // validating the entry if present. 510 // validating the entry if present.
511 if (request->get_upload() != NULL) 511 if (request->get_upload() != NULL)
512 extra_load_flags |= net::LOAD_ONLY_FROM_CACHE; 512 extra_load_flags |= net::LOAD_ONLY_FROM_CACHE;
513 else 513 else
514 extra_load_flags |= net::LOAD_PREFERRING_CACHE; 514 extra_load_flags |= net::LOAD_PREFERRING_CACHE;
515 } else { 515 } else {
516 extra_load_flags |= net::LOAD_DISABLE_CACHE; 516 extra_load_flags |= net::LOAD_DISABLE_CACHE;
517 } 517 }
518 request->SetLoadFlags(request->load_flags() | extra_load_flags); 518 request->SetLoadFlags(request->load_flags() | extra_load_flags);
519 519
520 // We treat a download as a main frame load, and thus update the policy URL on
521 // redirects.
522 //
523 // TODO(davidben): Is this correct? If this came from a
524 // ViewHostMsg_DownloadUrl in a frame, should it have first-party URL set
525 // appropriately?
526 request->set_first_party_url_policy(
527 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
528
520 // Check if the renderer is permitted to request the requested URL. 529 // Check if the renderer is permitted to request the requested URL.
521 if (!ChildProcessSecurityPolicyImpl::GetInstance()-> 530 if (!ChildProcessSecurityPolicyImpl::GetInstance()->
522 CanRequestURL(child_id, url)) { 531 CanRequestURL(child_id, url)) {
523 VLOG(1) << "Denied unauthorized download request for " 532 VLOG(1) << "Denied unauthorized download request for "
524 << url.possibly_invalid_spec(); 533 << url.possibly_invalid_spec();
525 return CallbackAndReturn(started_callback, 534 return CallbackAndReturn(started_callback,
526 DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST); 535 DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST);
527 } 536 }
528 537
529 request_id_--; 538 request_id_--;
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 GetContentClient()->browser()->OverrideCookieStoreForRenderProcess( 1036 GetContentClient()->browser()->OverrideCookieStoreForRenderProcess(
1028 child_id); 1037 child_id);
1029 scoped_ptr<net::URLRequest> new_request; 1038 scoped_ptr<net::URLRequest> new_request;
1030 new_request = request_context->CreateRequest( 1039 new_request = request_context->CreateRequest(
1031 request_data.url, request_data.priority, NULL, cookie_store); 1040 request_data.url, request_data.priority, NULL, cookie_store);
1032 1041
1033 new_request->set_method(request_data.method); 1042 new_request->set_method(request_data.method);
1034 new_request->set_first_party_for_cookies( 1043 new_request->set_first_party_for_cookies(
1035 request_data.first_party_for_cookies); 1044 request_data.first_party_for_cookies);
1036 1045
1046 // If the request is a MAIN_FRAME request, the first-party URL gets updated on
1047 // redirects.
1048 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) {
1049 new_request->set_first_party_url_policy(
1050 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
1051 }
1052
1037 const Referrer referrer(request_data.referrer, request_data.referrer_policy); 1053 const Referrer referrer(request_data.referrer, request_data.referrer_policy);
1038 SetReferrerForRequest(new_request.get(), referrer); 1054 SetReferrerForRequest(new_request.get(), referrer);
1039 1055
1040 net::HttpRequestHeaders headers; 1056 net::HttpRequestHeaders headers;
1041 headers.AddHeadersFromString(request_data.headers); 1057 headers.AddHeadersFromString(request_data.headers);
1042 new_request->SetExtraRequestHeaders(headers); 1058 new_request->SetExtraRequestHeaders(headers);
1043 1059
1044 new_request->SetLoadFlags(load_flags); 1060 new_request->SetLoadFlags(load_flags);
1045 1061
1046 // Resolve elements from request_body and prepare upload data. 1062 // Resolve elements from request_body and prepare upload data.
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 1997
1982 // Add a flag to selectively bypass the data reduction proxy if the resource 1998 // Add a flag to selectively bypass the data reduction proxy if the resource
1983 // type is not an image. 1999 // type is not an image.
1984 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) 2000 if (request_data.resource_type != RESOURCE_TYPE_IMAGE)
1985 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; 2001 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;
1986 2002
1987 return load_flags; 2003 return load_flags;
1988 } 2004 }
1989 2005
1990 } // namespace content 2006 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/layered_resource_handler.cc ('k') | content/browser/loader/resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698