OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_NET_SAFE_SEARCH_UTIL_H_ | 5 #ifndef CHROME_BROWSER_NET_SAFE_SEARCH_UTIL_H_ |
6 #define CHROME_BROWSER_NET_SAFE_SEARCH_UTIL_H_ | 6 #define CHROME_BROWSER_NET_SAFE_SEARCH_UTIL_H_ |
7 | 7 |
8 class GURL; | 8 class GURL; |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 class HttpRequestHeaders; | 11 class HttpRequestHeaders; |
12 class URLRequest; | 12 class URLRequest; |
13 } | 13 } |
14 | 14 |
15 namespace safe_search_util { | 15 namespace safe_search_util { |
16 | 16 |
17 // Values for YouTube Restricted Mode. | |
18 // VALUES MUST COINCIDE WITH ForceYouTubeRestrict POLICY. | |
19 enum class YouTubeRestrictMode { | |
20 kOff = 0, // Do not restrict YouTube content. YouTube might still | |
Thiemo Nagel
2016/10/05 17:38:14
Sadly the Chromium style guide requires SHOUTY_CAS
ljusten (tachyonic)
2016/10/06 10:14:45
Sigh... I cannot simply rename kStrict to STRICT b
| |
21 // restrict content based on its user settings. | |
22 kModerate = 1, // Enforce at least a moderately strict content filter for | |
23 // YouTube. | |
24 kStrict = 2 // Enforce a strict content filter for YouTube. | |
25 }; | |
26 | |
17 // If |request| is a request to Google Web Search, enforces that the SafeSearch | 27 // If |request| is a request to Google Web Search, enforces that the SafeSearch |
18 // query parameters are set to active. Sets |new_url| to a copy of the request | 28 // query parameters are set to active. Sets |new_url| to a copy of the request |
19 // url in which the query part contains the new values of the parameters. | 29 // url in which the query part contains the new values of the parameters. |
20 void ForceGoogleSafeSearch(const net::URLRequest* request, GURL* new_url); | 30 void ForceGoogleSafeSearch(const net::URLRequest* request, GURL* new_url); |
21 | 31 |
22 // If |request| is a request to YouTube, enforces YouTube's Safety Mode by | 32 // Does nothing if |request| is not a request to YouTube. Otherwise, if |mode| |
23 // setting YouTube's Safety Mode header. | 33 // is not |YouTubeRestrictMode::kOff|, enforces a minimum YouTube Restrict mode |
24 void ForceYouTubeSafetyMode(const net::URLRequest* request, | 34 // by setting YouTube Restrict header. Setting |YouTubeRestrictMode::kOff| |
25 net::HttpRequestHeaders* headers); | 35 // removes a Restrict header if it exists. |
36 void ForceYouTubeRestrict(const net::URLRequest* request, | |
37 net::HttpRequestHeaders* headers, | |
38 YouTubeRestrictMode mode); | |
26 | 39 |
27 int GetForceGoogleSafeSearchCountForTesting(); | 40 int GetForceGoogleSafeSearchCountForTesting(); |
28 int GetForceYouTubeSafetyModeCountForTesting(); | 41 int GetForceYouTubeRestrictCountForTesting(); |
29 void ClearForceGoogleSafeSearchCountForTesting(); | 42 void ClearForceGoogleSafeSearchCountForTesting(); |
30 void ClearForceYouTubeSafetyModeCountForTesting(); | 43 void ClearForceYouTubeRestrictCountForTesting(); |
31 | 44 |
32 } // namespace safe_search_util | 45 } // namespace safe_search_util |
33 | 46 |
34 #endif // CHROME_BROWSER_NET_SAFE_SEARCH_UTIL_H_ | 47 #endif // CHROME_BROWSER_NET_SAFE_SEARCH_UTIL_H_ |
OLD | NEW |