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

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

Issue 716813002: 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 | « content/content_common.gypi ('k') | content/public/common/referrer.cc » ('j') | 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..b45cd07150a846f8c124637a5577c6611e976e6c 100644
--- a/content/public/common/referrer.h
+++ b/content/public/common/referrer.h
@@ -16,46 +16,15 @@ namespace content {
// applied to this URL. When passing around referrers that will eventually end
// up being used for URL requests, always use this struct.
struct CONTENT_EXPORT Referrer {
- Referrer(const GURL& url, blink::WebReferrerPolicy policy) : url(url),
- policy(policy) {
- }
- Referrer() : policy(blink::WebReferrerPolicyDefault) {
- }
+ Referrer(const GURL& url, blink::WebReferrerPolicy policy)
+ : url(url), policy(policy) {}
+ Referrer() : policy(blink::WebReferrerPolicyDefault) {}
GURL url;
blink::WebReferrerPolicy policy;
static Referrer SanitizeForRequest(const GURL& request,
- const Referrer& referrer) {
- Referrer sanitized_referrer(referrer.url.GetAsReferrer(), referrer.policy);
-
- if (!request.SchemeIsHTTPOrHTTPS() ||
- !sanitized_referrer.url.SchemeIsHTTPOrHTTPS()) {
- sanitized_referrer.url = GURL();
- return sanitized_referrer;
- }
-
- switch (sanitized_referrer.policy) {
- case blink::WebReferrerPolicyDefault:
- if (sanitized_referrer.url.SchemeIsSecure() &&
- !request.SchemeIsSecure()) {
- sanitized_referrer.url = GURL();
- }
- break;
- case blink::WebReferrerPolicyAlways:
- break;
- case blink::WebReferrerPolicyNever:
- sanitized_referrer.url = GURL();
- break;
- case blink::WebReferrerPolicyOrigin:
- sanitized_referrer.url = sanitized_referrer.url.GetOrigin();
- break;
- default:
- NOTREACHED();
- break;
- }
- return sanitized_referrer;
- }
+ const Referrer& referrer);
};
} // namespace content
« no previous file with comments | « content/content_common.gypi ('k') | content/public/common/referrer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698