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 YouTubeRestrictMode { |
| 20 YOUTUBE_RESTRICT_OFF = 0, // Do not restrict YouTube content. YouTube |
| 21 // might still restrict content based on its |
| 22 // user settings. |
| 23 YOUTUBE_RESTRICT_MODERATE = 1, // Enforce at least a moderately strict |
| 24 // content filter for YouTube. |
| 25 YOUTUBE_RESTRICT_STRICT = 2, // Enforce a strict content filter for YouTube. |
| 26 YOUTUBE_RESTRICT_COUNT = 3 // Enum counter |
| 27 }; |
| 28 |
| 29 |
17 // If |request| is a request to Google Web Search, enforces that the SafeSearch | 30 // 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 | 31 // 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. | 32 // url in which the query part contains the new values of the parameters. |
20 void ForceGoogleSafeSearch(const net::URLRequest* request, GURL* new_url); | 33 void ForceGoogleSafeSearch(const net::URLRequest* request, GURL* new_url); |
21 | 34 |
22 // If |request| is a request to YouTube, enforces YouTube's Safety Mode by | 35 // Does nothing if |request| is not a request to YouTube. Otherwise, if |mode| |
23 // setting YouTube's Safety Mode header. | 36 // is not |YOUTUBE_RESTRICT_OFF|, enforces a minimum YouTube Restrict mode |
24 void ForceYouTubeSafetyMode(const net::URLRequest* request, | 37 // by setting YouTube Restrict header. Setting |YOUTUBE_RESTRICT_OFF| is not |
25 net::HttpRequestHeaders* headers); | 38 // supported and will do nothing in production. |
| 39 void ForceYouTubeRestrict(const net::URLRequest* request, |
| 40 net::HttpRequestHeaders* headers, |
| 41 YouTubeRestrictMode mode); |
26 | 42 |
27 int GetForceGoogleSafeSearchCountForTesting(); | 43 int GetForceGoogleSafeSearchCountForTesting(); |
28 int GetForceYouTubeSafetyModeCountForTesting(); | 44 int GetForceYouTubeRestrictCountForTesting(); |
29 void ClearForceGoogleSafeSearchCountForTesting(); | 45 void ClearForceGoogleSafeSearchCountForTesting(); |
30 void ClearForceYouTubeSafetyModeCountForTesting(); | 46 void ClearForceYouTubeRestrictCountForTesting(); |
31 | 47 |
32 } // namespace safe_search_util | 48 } // namespace safe_search_util |
33 | 49 |
34 #endif // CHROME_BROWSER_NET_SAFE_SEARCH_UTIL_H_ | 50 #endif // CHROME_BROWSER_NET_SAFE_SEARCH_UTIL_H_ |
OLD | NEW |