OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 namespace safe_browsing_util { | 259 namespace safe_browsing_util { |
260 | 260 |
261 // SafeBrowsing list names. | 261 // SafeBrowsing list names. |
262 extern const char kMalwareList[]; | 262 extern const char kMalwareList[]; |
263 extern const char kPhishingList[]; | 263 extern const char kPhishingList[]; |
264 // Binary Download list names. | 264 // Binary Download list names. |
265 extern const char kBinUrlList[]; | 265 extern const char kBinUrlList[]; |
266 extern const char kBinHashList[]; | 266 extern const char kBinHashList[]; |
267 // SafeBrowsing client-side detection whitelist list name. | 267 // SafeBrowsing client-side detection whitelist list name. |
268 extern const char kCsdWhiteList[]; | 268 extern const char kCsdWhiteList[]; |
| 269 // SafeBrowsing download whitelist list name. |
| 270 extern const char kDownloadWhiteList[]; |
269 | 271 |
270 enum ListType { | 272 enum ListType { |
271 INVALID = -1, | 273 INVALID = -1, |
272 MALWARE = 0, | 274 MALWARE = 0, |
273 PHISH = 1, | 275 PHISH = 1, |
274 BINURL = 2, | 276 BINURL = 2, |
275 BINHASH = 3, | 277 BINHASH = 3, |
276 CSDWHITELIST = 4, | 278 CSDWHITELIST = 4, |
| 279 // SafeBrowsing lists are stored in pairs. Keep ListType 5 |
| 280 // available for a potential second list that we would store in the |
| 281 // csd-whitelist store file. |
| 282 DOWNLOADWHITELIST = 6, |
277 }; | 283 }; |
278 | 284 |
279 // Maps a list name to ListType. | 285 // Maps a list name to ListType. |
280 int GetListId(const std::string& name); | 286 int GetListId(const std::string& name); |
281 // Maps a ListId to list name. Return false if fails. | 287 // Maps a ListId to list name. Return false if fails. |
282 bool GetListName(int list_id, std::string* list); | 288 bool GetListName(int list_id, std::string* list); |
283 | 289 |
284 | 290 |
285 // Canonicalizes url as per Google Safe Browsing Specification. | 291 // Canonicalizes url as per Google Safe Browsing Specification. |
286 // See section 6.1 in | 292 // See section 6.1 in |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 327 |
322 GURL GeneratePhishingReportUrl(const std::string& report_page, | 328 GURL GeneratePhishingReportUrl(const std::string& report_page, |
323 const std::string& url_to_report, | 329 const std::string& url_to_report, |
324 bool is_client_side_detection); | 330 bool is_client_side_detection); |
325 | 331 |
326 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out); | 332 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out); |
327 std::string SBFullHashToString(const SBFullHash& hash_out); | 333 std::string SBFullHashToString(const SBFullHash& hash_out); |
328 } // namespace safe_browsing_util | 334 } // namespace safe_browsing_util |
329 | 335 |
330 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 336 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
OLD | NEW |