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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 714813003: Referrer Policy: Add new policies to URLRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/referrer_policy/referrer-policy-start.html ('k') | net/url_request/url_request.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index c8341d63c690d42639a97299692867a4a7bddab2..85ac2bf6214b07e56275281549c1ad0933e04d43 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -231,9 +231,9 @@ void AbortRequestBeforeItStarts(ResourceMessageFilter* filter,
}
void SetReferrerForRequest(net::URLRequest* request, const Referrer& referrer) {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!referrer.url.is_valid() ||
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kNoReferrers)) {
+ command_line->HasSwitch(switches::kNoReferrers)) {
request->SetReferrer(std::string());
} else {
request->SetReferrer(referrer.url.spec());
@@ -247,10 +247,18 @@ void SetReferrerForRequest(net::URLRequest* request, const Referrer& referrer) {
case blink::WebReferrerPolicyOrigin:
net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER;
break;
+ case blink::WebReferrerPolicyNoReferrerWhenDowngrade:
+ net_referrer_policy =
+ net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
+ break;
case blink::WebReferrerPolicyDefault:
default:
net_referrer_policy =
- net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
+ command_line->HasSwitch(switches::kReducedReferrerGranularity)
+ ? net::URLRequest::
+ REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN
+ : net::URLRequest::
+ CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
break;
}
request->set_referrer_policy(net_referrer_policy);
« no previous file with comments | « chrome/test/data/referrer_policy/referrer-policy-start.html ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698