OLD | NEW |
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 #ifndef CONTENT_PUBLIC_COMMON_REFERRER_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_REFERRER_H_ |
6 #define CONTENT_PUBLIC_COMMON_REFERRER_H_ | 6 #define CONTENT_PUBLIC_COMMON_REFERRER_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "net/url_request/url_request.h" |
10 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 11 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
12 | 13 |
13 namespace net { | |
14 class URLRequest; | |
15 } | |
16 | |
17 namespace content { | 14 namespace content { |
18 | 15 |
19 // This struct holds a referrer URL, as well as the referrer policy to be | 16 // This struct holds a referrer URL, as well as the referrer policy to be |
20 // applied to this URL. When passing around referrers that will eventually end | 17 // applied to this URL. When passing around referrers that will eventually end |
21 // up being used for URL requests, always use this struct. | 18 // up being used for URL requests, always use this struct. |
22 struct CONTENT_EXPORT Referrer { | 19 struct CONTENT_EXPORT Referrer { |
23 Referrer(const GURL& url, blink::WebReferrerPolicy policy) | 20 Referrer(const GURL& url, blink::WebReferrerPolicy policy) |
24 : url(url), policy(policy) {} | 21 : url(url), policy(policy) {} |
25 Referrer() : policy(blink::WebReferrerPolicyDefault) {} | 22 Referrer() : policy(blink::WebReferrerPolicyDefault) {} |
26 | 23 |
27 GURL url; | 24 GURL url; |
28 blink::WebReferrerPolicy policy; | 25 blink::WebReferrerPolicy policy; |
29 | 26 |
30 static Referrer SanitizeForRequest(const GURL& request, | 27 static Referrer SanitizeForRequest(const GURL& request, |
31 const Referrer& referrer); | 28 const Referrer& referrer); |
32 | 29 |
33 static void SetReferrerForRequest(net::URLRequest* request, | 30 static void SetReferrerForRequest(net::URLRequest* request, |
34 const Referrer& referrer); | 31 const Referrer& referrer); |
| 32 |
| 33 static net::URLRequest::ReferrerPolicy ReferrerPolicyForUrlRequest( |
| 34 const Referrer& referrer); |
35 }; | 35 }; |
36 | 36 |
37 } // namespace content | 37 } // namespace content |
38 | 38 |
39 #endif // CONTENT_PUBLIC_COMMON_REFERRER_H_ | 39 #endif // CONTENT_PUBLIC_COMMON_REFERRER_H_ |
OLD | NEW |