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

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

Issue 10387090: Pass the referrer policy with the referrer for the save package code path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 7 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/renderer_host/resource_dispatcher_host_impl.h" 7 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 if (!url.is_valid() || !(url.SchemeIs("http") || url.SchemeIs("https"))) 1131 if (!url.is_valid() || !(url.SchemeIs("http") || url.SchemeIs("https")))
1132 return; 1132 return;
1133 1133
1134 filter_->GetURLRequestContext(resource_type)->http_transaction_factory()-> 1134 filter_->GetURLRequestContext(resource_type)->http_transaction_factory()->
1135 GetCache()->OnExternalCacheHit(url, http_method); 1135 GetCache()->OnExternalCacheHit(url, http_method);
1136 } 1136 }
1137 1137
1138 // This function is only used for saving feature. 1138 // This function is only used for saving feature.
1139 void ResourceDispatcherHostImpl::BeginSaveFile( 1139 void ResourceDispatcherHostImpl::BeginSaveFile(
1140 const GURL& url, 1140 const GURL& url,
1141 const GURL& referrer, 1141 const content::Referrer& referrer,
1142 int child_id, 1142 int child_id,
1143 int route_id, 1143 int route_id,
1144 ResourceContext* context) { 1144 ResourceContext* context) {
1145 if (is_shutdown_) 1145 if (is_shutdown_)
1146 return; 1146 return;
1147 1147
1148 // http://crbug.com/90971 1148 // http://crbug.com/90971
1149 char url_buf[128]; 1149 char url_buf[128];
1150 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); 1150 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf));
1151 base::debug::Alias(url_buf); 1151 base::debug::Alias(url_buf);
(...skipping 12 matching lines...) Expand all
1164 if (!known_proto) { 1164 if (!known_proto) {
1165 // Since any URLs which have non-standard scheme have been filtered 1165 // Since any URLs which have non-standard scheme have been filtered
1166 // by save manager(see GURL::SchemeIsStandard). This situation 1166 // by save manager(see GURL::SchemeIsStandard). This situation
1167 // should not happen. 1167 // should not happen.
1168 NOTREACHED(); 1168 NOTREACHED();
1169 return; 1169 return;
1170 } 1170 }
1171 1171
1172 net::URLRequest* request = new net::URLRequest(url, this); 1172 net::URLRequest* request = new net::URLRequest(url, this);
1173 request->set_method("GET"); 1173 request->set_method("GET");
1174 request->set_referrer(MaybeStripReferrer(referrer).spec()); 1174 request->set_referrer(MaybeStripReferrer(referrer.url).spec());
1175 webkit_glue::ConfigureURLRequestForReferrerPolicy(request, referrer.policy);
1175 // So far, for saving page, we need fetch content from cache, in the 1176 // So far, for saving page, we need fetch content from cache, in the
1176 // future, maybe we can use a configuration to configure this behavior. 1177 // future, maybe we can use a configuration to configure this behavior.
1177 request->set_load_flags(net::LOAD_PREFERRING_CACHE); 1178 request->set_load_flags(net::LOAD_PREFERRING_CACHE);
1178 request->set_context(context->GetRequestContext()); 1179 request->set_context(context->GetRequestContext());
1179 1180
1180 // Since we're just saving some resources we need, disallow downloading. 1181 // Since we're just saving some resources we need, disallow downloading.
1181 ResourceRequestInfoImpl* extra_info = 1182 ResourceRequestInfoImpl* extra_info =
1182 CreateRequestInfo(handler, child_id, route_id, false, context); 1183 CreateRequestInfo(handler, child_id, route_id, false, context);
1183 extra_info->AssociateWithRequest(request); // Request takes ownership. 1184 extra_info->AssociateWithRequest(request); // Request takes ownership.
1184 1185
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 return allow_cross_origin_auth_prompt_; 2324 return allow_cross_origin_auth_prompt_;
2324 } 2325 }
2325 2326
2326 bool ResourceDispatcherHostImpl::IsTransferredNavigation( 2327 bool ResourceDispatcherHostImpl::IsTransferredNavigation(
2327 const GlobalRequestID& transferred_request_id) const { 2328 const GlobalRequestID& transferred_request_id) const {
2328 return transferred_navigations_.find(transferred_request_id) != 2329 return transferred_navigations_.find(transferred_request_id) !=
2329 transferred_navigations_.end(); 2330 transferred_navigations_.end();
2330 } 2331 }
2331 2332
2332 } // namespace content 2333 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698