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

Unified Diff: content/public/common/referrer.h

Issue 715513004: Revert of Revert of Referrer Policy: Update SanitizeForRequest with new default behavior. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/common/referrer.h
diff --git a/content/public/common/referrer.h b/content/public/common/referrer.h
index 122c5ead79096c2fb148d11206e8071f48671074..5a3b0118d4c5e108c5bf48fe3f7fa012c0a16f97 100644
--- a/content/public/common/referrer.h
+++ b/content/public/common/referrer.h
@@ -5,8 +5,10 @@
#ifndef CONTENT_PUBLIC_COMMON_REFERRER_H_
#define CONTENT_PUBLIC_COMMON_REFERRER_H_
+#include "base/command_line.h"
#include "base/logging.h"
#include "content/common/content_export.h"
+#include "content/public/common/content_switches.h"
#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
#include "url/gurl.h"
@@ -35,12 +37,22 @@
return sanitized_referrer;
}
+ bool is_downgrade =
+ sanitized_referrer.url.SchemeIsSecure() && !request.SchemeIsSecure();
+
switch (sanitized_referrer.policy) {
case blink::WebReferrerPolicyDefault:
- if (sanitized_referrer.url.SchemeIsSecure() &&
- !request.SchemeIsSecure()) {
+ if (is_downgrade) {
sanitized_referrer.url = GURL();
+ } else if (request.GetOrigin() != sanitized_referrer.url.GetOrigin() &&
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kReducedReferrerGranularity)) {
+ sanitized_referrer.url = sanitized_referrer.url.GetOrigin();
}
+ break;
+ case blink::WebReferrerPolicyNoReferrerWhenDowngrade:
+ if (is_downgrade)
+ sanitized_referrer.url = GURL();
break;
case blink::WebReferrerPolicyAlways:
break;
« 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