| 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 std::vector<SBPrefix>* prefix_hits, | 103 std::vector<SBPrefix>* prefix_hits, |
| 104 std::vector<SBFullHashResult>* full_hits, | 104 std::vector<SBFullHashResult>* full_hits, |
| 105 base::Time last_update) = 0; | 105 base::Time last_update) = 0; |
| 106 | 106 |
| 107 // Returns false if none of |urls| are in Download database. If it returns | 107 // Returns false if none of |urls| are in Download database. If it returns |
| 108 // true, |prefix_hits| should contain the prefixes for the URLs that were in | 108 // true, |prefix_hits| should contain the prefixes for the URLs that were in |
| 109 // the database. This function could ONLY be accessed from creation thread. | 109 // the database. This function could ONLY be accessed from creation thread. |
| 110 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, | 110 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, |
| 111 std::vector<SBPrefix>* prefix_hits) = 0; | 111 std::vector<SBPrefix>* prefix_hits) = 0; |
| 112 | 112 |
| 113 // Returns false if |prefix| is not in Download database. | |
| 114 // This function could ONLY be accessed from creation thread. | |
| 115 virtual bool ContainsDownloadHashPrefix(const SBPrefix& prefix) = 0; | |
| 116 | |
| 117 // Returns false if |url| is not on the client-side phishing detection | 113 // Returns false if |url| is not on the client-side phishing detection |
| 118 // whitelist. Otherwise, this function returns true. Note: the whitelist | 114 // whitelist. Otherwise, this function returns true. Note: the whitelist |
| 119 // only contains full-length hashes so we don't return any prefix hit. | 115 // only contains full-length hashes so we don't return any prefix hit. |
| 120 // This function should only be called from the IO thread. | 116 // This function should only be called from the IO thread. |
| 121 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) = 0; | 117 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) = 0; |
| 122 | 118 |
| 123 // The download whitelist is used for two purposes: a white-domain list of | 119 // The download whitelist is used for two purposes: a white-domain list of |
| 124 // sites that are considered to host only harmless binaries as well as a | 120 // sites that are considered to host only harmless binaries as well as a |
| 125 // whitelist of arbitrary strings such as hashed certificate authorities that | 121 // whitelist of arbitrary strings such as hashed certificate authorities that |
| 126 // are considered to be trusted. The two methods below let you lookup | 122 // are considered to be trusted. The two methods below let you lookup |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // Implement SafeBrowsingDatabase interface. | 290 // Implement SafeBrowsingDatabase interface. |
| 295 virtual void Init(const base::FilePath& filename) OVERRIDE; | 291 virtual void Init(const base::FilePath& filename) OVERRIDE; |
| 296 virtual bool ResetDatabase() OVERRIDE; | 292 virtual bool ResetDatabase() OVERRIDE; |
| 297 virtual bool ContainsBrowseUrl(const GURL& url, | 293 virtual bool ContainsBrowseUrl(const GURL& url, |
| 298 std::string* matching_list, | 294 std::string* matching_list, |
| 299 std::vector<SBPrefix>* prefix_hits, | 295 std::vector<SBPrefix>* prefix_hits, |
| 300 std::vector<SBFullHashResult>* full_hits, | 296 std::vector<SBFullHashResult>* full_hits, |
| 301 base::Time last_update) OVERRIDE; | 297 base::Time last_update) OVERRIDE; |
| 302 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, | 298 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, |
| 303 std::vector<SBPrefix>* prefix_hits) OVERRIDE; | 299 std::vector<SBPrefix>* prefix_hits) OVERRIDE; |
| 304 virtual bool ContainsDownloadHashPrefix(const SBPrefix& prefix) OVERRIDE; | |
| 305 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) OVERRIDE; | 300 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) OVERRIDE; |
| 306 virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) OVERRIDE; | 301 virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) OVERRIDE; |
| 307 virtual bool ContainsDownloadWhitelistedString( | 302 virtual bool ContainsDownloadWhitelistedString( |
| 308 const std::string& str) OVERRIDE; | 303 const std::string& str) OVERRIDE; |
| 309 virtual bool ContainsExtensionPrefixes( | 304 virtual bool ContainsExtensionPrefixes( |
| 310 const std::vector<SBPrefix>& prefixes, | 305 const std::vector<SBPrefix>& prefixes, |
| 311 std::vector<SBPrefix>* prefix_hits) OVERRIDE; | 306 std::vector<SBPrefix>* prefix_hits) OVERRIDE; |
| 312 virtual bool ContainsSideEffectFreeWhitelistUrl(const GURL& url) OVERRIDE; | 307 virtual bool ContainsSideEffectFreeWhitelistUrl(const GURL& url) OVERRIDE; |
| 313 virtual bool ContainsMalwareIP(const std::string& ip_address) OVERRIDE; | 308 virtual bool ContainsMalwareIP(const std::string& ip_address) OVERRIDE; |
| 314 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) OVERRIDE; | 309 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) OVERRIDE; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 // Used to check if a prefix was in the browse database. | 468 // Used to check if a prefix was in the browse database. |
| 474 base::FilePath browse_prefix_set_filename_; | 469 base::FilePath browse_prefix_set_filename_; |
| 475 scoped_ptr<safe_browsing::PrefixSet> browse_prefix_set_; | 470 scoped_ptr<safe_browsing::PrefixSet> browse_prefix_set_; |
| 476 | 471 |
| 477 // Used to check if a prefix was in the browse database. | 472 // Used to check if a prefix was in the browse database. |
| 478 base::FilePath side_effect_free_whitelist_prefix_set_filename_; | 473 base::FilePath side_effect_free_whitelist_prefix_set_filename_; |
| 479 scoped_ptr<safe_browsing::PrefixSet> side_effect_free_whitelist_prefix_set_; | 474 scoped_ptr<safe_browsing::PrefixSet> side_effect_free_whitelist_prefix_set_; |
| 480 }; | 475 }; |
| 481 | 476 |
| 482 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 477 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
| OLD | NEW |