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

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

Issue 717503002: Referrer Policy: Distinguish "default" from "no referrer when downgrade". [1/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 base::CommandLine::ForCurrentProcess()->HasSwitch( 235 base::CommandLine::ForCurrentProcess()->HasSwitch(
236 switches::kNoReferrers)) { 236 switches::kNoReferrers)) {
237 request->SetReferrer(std::string()); 237 request->SetReferrer(std::string());
238 } else { 238 } else {
239 request->SetReferrer(referrer.url.spec()); 239 request->SetReferrer(referrer.url.spec());
240 } 240 }
241 241
242 net::URLRequest::ReferrerPolicy net_referrer_policy = 242 net::URLRequest::ReferrerPolicy net_referrer_policy =
243 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE; 243 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
244 switch (referrer.policy) { 244 switch (referrer.policy) {
245 case blink::WebReferrerPolicyDefault:
246 net_referrer_policy =
247 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
248 break;
249 case blink::WebReferrerPolicyAlways: 245 case blink::WebReferrerPolicyAlways:
250 case blink::WebReferrerPolicyNever: 246 case blink::WebReferrerPolicyNever:
251 case blink::WebReferrerPolicyOrigin: 247 case blink::WebReferrerPolicyOrigin:
252 net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER; 248 net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER;
253 break; 249 break;
250 case blink::WebReferrerPolicyDefault:
251 default:
252 net_referrer_policy =
253 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
254 break;
254 } 255 }
255 request->set_referrer_policy(net_referrer_policy); 256 request->set_referrer_policy(net_referrer_policy);
256 } 257 }
257 258
258 // Consults the RendererSecurity policy to determine whether the 259 // Consults the RendererSecurity policy to determine whether the
259 // ResourceDispatcherHostImpl should service this request. A request might be 260 // ResourceDispatcherHostImpl should service this request. A request might be
260 // disallowed if the renderer is not authorized to retrieve the request URL or 261 // disallowed if the renderer is not authorized to retrieve the request URL or
261 // if the renderer is attempting to upload an unauthorized file. 262 // if the renderer is attempting to upload an unauthorized file.
262 bool ShouldServiceRequest(int process_type, 263 bool ShouldServiceRequest(int process_type,
263 int child_id, 264 int child_id,
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 2343
2343 // Add a flag to selectively bypass the data reduction proxy if the resource 2344 // Add a flag to selectively bypass the data reduction proxy if the resource
2344 // type is not an image. 2345 // type is not an image.
2345 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) 2346 if (request_data.resource_type != RESOURCE_TYPE_IMAGE)
2346 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; 2347 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;
2347 2348
2348 return load_flags; 2349 return load_flags;
2349 } 2350 }
2350 2351
2351 } // namespace content 2352 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698