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 // Utilities for the SafeBrowsing code. | 5 // Utilities for the SafeBrowsing code. |
6 | 6 |
7 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 7 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
8 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 8 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
9 | 9 |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // Obsolete SIDEEFFECTFREEWHITELIST = 10, | 193 // Obsolete SIDEEFFECTFREEWHITELIST = 10, |
194 // See above comment. Leave 11 available. | 194 // See above comment. Leave 11 available. |
195 IPBLACKLIST = 12, | 195 IPBLACKLIST = 12, |
196 // See above comment. Leave 13 available. | 196 // See above comment. Leave 13 available. |
197 UNWANTEDURL = 14, | 197 UNWANTEDURL = 14, |
198 // See above comment. Leave 15 available. | 198 // See above comment. Leave 15 available. |
199 INCLUSIONWHITELIST = 16, | 199 INCLUSIONWHITELIST = 16, |
200 // See above comment. Leave 17 available. | 200 // See above comment. Leave 17 available. |
201 }; | 201 }; |
202 | 202 |
203 // M40 experimental flag controls rollout of the UwS warning. | |
204 enum UnwantedStatus { | |
205 UWS_OFF, | |
206 UWS_ON_INVISIBLE, | |
207 UWS_ON | |
208 }; | |
209 | |
210 // Maps a list name to ListType. | 203 // Maps a list name to ListType. |
211 ListType GetListId(const base::StringPiece& name); | 204 ListType GetListId(const base::StringPiece& name); |
212 | 205 |
213 // Maps a ListId to list name. Return false if fails. | 206 // Maps a ListId to list name. Return false if fails. |
214 bool GetListName(ListType list_id, std::string* list); | 207 bool GetListName(ListType list_id, std::string* list); |
215 | 208 |
216 // Canonicalizes url as per Google Safe Browsing Specification. | 209 // Canonicalizes url as per Google Safe Browsing Specification. |
217 // See section 6.1 in | 210 // See section 6.1 in |
218 // http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec. | 211 // http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec. |
219 void CanonicalizeUrl(const GURL& url, std::string* canonicalized_hostname, | 212 void CanonicalizeUrl(const GURL& url, std::string* canonicalized_hostname, |
(...skipping 10 matching lines...) Expand all Loading... |
230 // Given a URL, returns all the patterns we need to check. | 223 // Given a URL, returns all the patterns we need to check. |
231 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); | 224 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); |
232 | 225 |
233 GURL GeneratePhishingReportUrl(const std::string& report_page, | 226 GURL GeneratePhishingReportUrl(const std::string& report_page, |
234 const std::string& url_to_report, | 227 const std::string& url_to_report, |
235 bool is_client_side_detection); | 228 bool is_client_side_detection); |
236 | 229 |
237 SBFullHash StringToSBFullHash(const std::string& hash_in); | 230 SBFullHash StringToSBFullHash(const std::string& hash_in); |
238 std::string SBFullHashToString(const SBFullHash& hash_out); | 231 std::string SBFullHashToString(const SBFullHash& hash_out); |
239 | 232 |
240 // Look up the status of the UwS warning. The default is off. | |
241 UnwantedStatus GetUnwantedTrialGroup(); | |
242 | |
243 } // namespace safe_browsing_util | 233 } // namespace safe_browsing_util |
244 | 234 |
245 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 235 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
OLD | NEW |