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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Given a URL, returns all the hosts we need to check. They are returned | 195 // Given a URL, returns all the hosts we need to check. They are returned |
196 // in order of size (i.e. b.c is first, then a.b.c). | 196 // in order of size (i.e. b.c is first, then a.b.c). |
197 void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts); | 197 void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts); |
198 | 198 |
199 // Given a URL, returns all the paths we need to check. | 199 // Given a URL, returns all the paths we need to check. |
200 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); | 200 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); |
201 | 201 |
202 // Given a URL, returns all the patterns we need to check. | 202 // Given a URL, returns all the patterns we need to check. |
203 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); | 203 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); |
204 | 204 |
205 int GetHashIndex(const SBFullHash& hash, | |
206 const std::vector<SBFullHashResult>& full_hashes); | |
207 | |
208 // Given a URL, compare all the possible host + path full hashes to the set of | |
209 // provided full hashes. Returns the index of the match if one is found, or -1 | |
210 // otherwise. | |
211 int GetUrlHashIndex(const GURL& url, | |
212 const std::vector<SBFullHashResult>& full_hashes); | |
213 | |
214 GURL GeneratePhishingReportUrl(const std::string& report_page, | 205 GURL GeneratePhishingReportUrl(const std::string& report_page, |
215 const std::string& url_to_report, | 206 const std::string& url_to_report, |
216 bool is_client_side_detection); | 207 bool is_client_side_detection); |
217 | 208 |
218 SBFullHash StringToSBFullHash(const std::string& hash_in); | 209 SBFullHash StringToSBFullHash(const std::string& hash_in); |
219 std::string SBFullHashToString(const SBFullHash& hash_out); | 210 std::string SBFullHashToString(const SBFullHash& hash_out); |
220 | 211 |
221 } // namespace safe_browsing_util | 212 } // namespace safe_browsing_util |
222 | 213 |
223 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 214 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
OLD | NEW |