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 | |
30 // If |request| is a request to Google Web Search, enforces that the SafeSearch | 17 // If |request| is a request to Google Web Search, enforces that the SafeSearch |
31 // query parameters are set to active. Sets |new_url| to a copy of the request | 18 // query parameters are set to active. Sets |new_url| to a copy of the request |
32 // url in which the query part contains the new values of the parameters. | 19 // url in which the query part contains the new values of the parameters. |
33 void ForceGoogleSafeSearch(const net::URLRequest* request, GURL* new_url); | 20 void ForceGoogleSafeSearch(const net::URLRequest* request, GURL* new_url); |
34 | 21 |
35 // Does nothing if |request| is not a request to YouTube. Otherwise, if |mode| | 22 // If |request| is a request to YouTube, enforces YouTube's Safety Mode by |
36 // is not |YOUTUBE_RESTRICT_OFF|, enforces a minimum YouTube Restrict mode | 23 // setting YouTube's Safety Mode header. |
37 // by setting YouTube Restrict header. Setting |YOUTUBE_RESTRICT_OFF| is not | 24 void ForceYouTubeSafetyMode(const net::URLRequest* request, |
38 // supported and will do nothing in production. | 25 net::HttpRequestHeaders* headers); |
39 void ForceYouTubeRestrict(const net::URLRequest* request, | |
40 net::HttpRequestHeaders* headers, | |
41 YouTubeRestrictMode mode); | |
42 | 26 |
43 int GetForceGoogleSafeSearchCountForTesting(); | 27 int GetForceGoogleSafeSearchCountForTesting(); |
44 int GetForceYouTubeRestrictCountForTesting(); | 28 int GetForceYouTubeSafetyModeCountForTesting(); |
45 void ClearForceGoogleSafeSearchCountForTesting(); | 29 void ClearForceGoogleSafeSearchCountForTesting(); |
46 void ClearForceYouTubeRestrictCountForTesting(); | 30 void ClearForceYouTubeSafetyModeCountForTesting(); |
47 | 31 |
48 } // namespace safe_search_util | 32 } // namespace safe_search_util |
49 | 33 |
50 #endif // CHROME_BROWSER_NET_SAFE_SEARCH_UTIL_H_ | 34 #endif // CHROME_BROWSER_NET_SAFE_SEARCH_UTIL_H_ |
OLD | NEW |