| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string.h> | 10 #include <string.h> |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 | 271 |
| 272 // Helper functions ----------------------------------------------------------- | 272 // Helper functions ----------------------------------------------------------- |
| 273 | 273 |
| 274 namespace safe_browsing_util { | 274 namespace safe_browsing_util { |
| 275 | 275 |
| 276 // SafeBrowsing list names. | 276 // SafeBrowsing list names. |
| 277 extern const char kMalwareList[]; | 277 extern const char kMalwareList[]; |
| 278 extern const char kPhishingList[]; | 278 extern const char kPhishingList[]; |
| 279 | 279 |
| 280 // Converts between the SafeBrowsing list names and their enumerated value. |
| 281 // If the list names change, both of these methods must be updated. |
| 282 enum ListType { |
| 283 MALWARE = 0, |
| 284 PHISH = 1, |
| 285 }; |
| 286 int GetListId(const std::string& name); |
| 287 std::string GetListName(int list_id); |
| 288 |
| 280 void FreeChunks(std::deque<SBChunk>* chunks); | 289 void FreeChunks(std::deque<SBChunk>* chunks); |
| 281 | 290 |
| 282 // Given a URL, returns all the hosts we need to check. They are returned | 291 // Given a URL, returns all the hosts we need to check. They are returned |
| 283 // in order of size (i.e. b.c is first, then a.b.c). | 292 // in order of size (i.e. b.c is first, then a.b.c). |
| 284 void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts); | 293 void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts); |
| 285 | 294 |
| 286 // Given a URL, returns all the paths we need to check. | 295 // Given a URL, returns all the paths we need to check. |
| 287 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); | 296 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); |
| 288 | 297 |
| 289 // Given a URL, compare all the possible host + path full hashes to the set of | 298 // Given a URL, compare all the possible host + path full hashes to the set of |
| (...skipping 10 matching lines...) Expand all Loading... |
| 300 const std::string& mac, | 309 const std::string& mac, |
| 301 const char* data, | 310 const char* data, |
| 302 int data_length); | 311 int data_length); |
| 303 | 312 |
| 304 GURL GeneratePhishingReportUrl(const std::string& report_page, | 313 GURL GeneratePhishingReportUrl(const std::string& report_page, |
| 305 const std::string& url_to_report); | 314 const std::string& url_to_report); |
| 306 | 315 |
| 307 } // namespace safe_browsing_util | 316 } // namespace safe_browsing_util |
| 308 | 317 |
| 309 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 318 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
| OLD | NEW |