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 { | |
Marc Treib
2016/09/05 09:58:10
optional: enum class, with values OFF, MODERATE, S
ljusten (tachyonic)
2016/09/05 15:24:32
I like that. It also adds type-safety as it requir
| |
20 YOUTUBE_OFF = 0, // Do not restrict YouTube content. YouTube might still | |
21 // restrict content based on its user settings. | |
22 YOUTUBE_MODERATE = 1, // Enforce at least a moderately strict content filter | |
23 // for YouTube. | |
24 YOUTUBE_STRICT = 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 |YOUTUBE_OFF|, enforces a minimum YouTube Restrict mode by setting |
24 void ForceYouTubeSafetyMode(const net::URLRequest* request, | 34 // YouTube Restrict header. Setting |YOUTUBE_OFF| removes a Restrict header |
25 net::HttpRequestHeaders* headers); | 35 // 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 |