1 // Copyright 2020 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_URL_REQUEST_REFERRER_POLICY_H_ 6 #define NET_URL_REQUEST_REFERRER_POLICY_H_ 7 8 namespace net { 9 10 // A ReferrerPolicy controls the contents of the Referer header when URLRequest 11 // following HTTP redirects. Note that setting a ReferrerPolicy on the request 12 // has no effect on the Referer header of the initial leg of the request; the 13 // caller is responsible for setting the initial Referer, and the ReferrerPolicy 14 // only controls what happens to the Referer while following redirects. 15 // 16 // NOTE: This enum is persisted to histograms. Do not change or reorder values. 17 // TODO(~M89): Once the Net.URLRequest.ReferrerPolicyForRequest metric is 18 // retired. 19 enum class ReferrerPolicy { 20 // Clear the referrer header if the header value is HTTPS but the request 21 // destination is HTTP. This is the default behavior of URLRequest. 22 CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE = 0, 23 // A slight variant on CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE: 24 // If the request destination is HTTP, an HTTPS referrer will be cleared. If 25 // the request's destination is cross-origin with the referrer (but does not 26 // downgrade), the referrer's granularity will be stripped down to an origin 27 // rather than a full URL. Same-origin requests will send the full referrer. 28 REDUCE_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN = 1, 29 // Strip the referrer down to an origin when the origin of the referrer is 30 // different from the destination's origin. 31 ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN = 2, 32 // Never change the referrer. 33 NEVER_CLEAR = 3, 34 // Strip the referrer down to the origin regardless of the redirect 35 // location. 36 ORIGIN = 4, 37 // Clear the referrer when the request's referrer is cross-origin with 38 // the request's destination. 39 CLEAR_ON_TRANSITION_CROSS_ORIGIN = 5, 40 // Strip the referrer down to the origin, but clear it entirely if the 41 // referrer value is HTTPS and the destination is HTTP. 42 ORIGIN_CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE = 6, 43 // Always clear the referrer regardless of the request destination. 44 NO_REFERRER = 7, 45 MAX = NO_REFERRER, 46 }; 47 48 } // namespace net 49 50 #endif // NET_URL_REQUEST_REFERRER_POLICY_H_ 51