| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 virtual ~SafeBrowsingDatabase(); | 98 virtual ~SafeBrowsingDatabase(); |
| 99 | 99 |
| 100 // Initializes the database with the given filename. | 100 // Initializes the database with the given filename. |
| 101 virtual void Init(const base::FilePath& filename) = 0; | 101 virtual void Init(const base::FilePath& filename) = 0; |
| 102 | 102 |
| 103 // Deletes the current database and creates a new one. | 103 // Deletes the current database and creates a new one. |
| 104 virtual bool ResetDatabase() = 0; | 104 virtual bool ResetDatabase() = 0; |
| 105 | 105 |
| 106 // Returns false if |url| is not in the browse database. If it | 106 // Returns false if |url| is not in the browse database. If it returns true, |
| 107 // returns true, then either |matching_list| is the name of the matching | 107 // then |prefix_hits| and |full_hits| contains the matching hash prefixes. |
| 108 // list, or |prefix_hits| and |full_hits| contains the matching hash | 108 // This function is safe to call from threads other than the creation thread. |
| 109 // prefixes. This function is safe to call from threads other than | |
| 110 // the creation thread. | |
| 111 virtual bool ContainsBrowseUrl(const GURL& url, | 109 virtual bool ContainsBrowseUrl(const GURL& url, |
| 112 std::string* matching_list, | |
| 113 std::vector<SBPrefix>* prefix_hits, | 110 std::vector<SBPrefix>* prefix_hits, |
| 114 std::vector<SBFullHashResult>* full_hits, | 111 std::vector<SBFullHashResult>* full_hits, |
| 115 base::Time last_update) = 0; | 112 base::Time last_update) = 0; |
| 116 | 113 |
| 117 // Returns false if none of |urls| are in Download database. If it returns | 114 // Returns false if none of |urls| are in Download database. If it returns |
| 118 // true, |prefix_hits| should contain the prefixes for the URLs that were in | 115 // true, |prefix_hits| should contain the prefixes for the URLs that were in |
| 119 // the database. This function could ONLY be accessed from creation thread. | 116 // the database. This function could ONLY be accessed from creation thread. |
| 120 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, | 117 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, |
| 121 std::vector<SBPrefix>* prefix_hits) = 0; | 118 std::vector<SBPrefix>* prefix_hits) = 0; |
| 122 | 119 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // Create a database with a browse store. This is a legacy interface that | 291 // Create a database with a browse store. This is a legacy interface that |
| 295 // useds Sqlite. | 292 // useds Sqlite. |
| 296 SafeBrowsingDatabaseNew(); | 293 SafeBrowsingDatabaseNew(); |
| 297 | 294 |
| 298 virtual ~SafeBrowsingDatabaseNew(); | 295 virtual ~SafeBrowsingDatabaseNew(); |
| 299 | 296 |
| 300 // Implement SafeBrowsingDatabase interface. | 297 // Implement SafeBrowsingDatabase interface. |
| 301 virtual void Init(const base::FilePath& filename) OVERRIDE; | 298 virtual void Init(const base::FilePath& filename) OVERRIDE; |
| 302 virtual bool ResetDatabase() OVERRIDE; | 299 virtual bool ResetDatabase() OVERRIDE; |
| 303 virtual bool ContainsBrowseUrl(const GURL& url, | 300 virtual bool ContainsBrowseUrl(const GURL& url, |
| 304 std::string* matching_list, | |
| 305 std::vector<SBPrefix>* prefix_hits, | 301 std::vector<SBPrefix>* prefix_hits, |
| 306 std::vector<SBFullHashResult>* full_hits, | 302 std::vector<SBFullHashResult>* full_hits, |
| 307 base::Time last_update) OVERRIDE; | 303 base::Time last_update) OVERRIDE; |
| 308 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, | 304 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, |
| 309 std::vector<SBPrefix>* prefix_hits) OVERRIDE; | 305 std::vector<SBPrefix>* prefix_hits) OVERRIDE; |
| 310 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) OVERRIDE; | 306 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) OVERRIDE; |
| 311 virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) OVERRIDE; | 307 virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) OVERRIDE; |
| 312 virtual bool ContainsDownloadWhitelistedString( | 308 virtual bool ContainsDownloadWhitelistedString( |
| 313 const std::string& str) OVERRIDE; | 309 const std::string& str) OVERRIDE; |
| 314 virtual bool ContainsExtensionPrefixes( | 310 virtual bool ContainsExtensionPrefixes( |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 // Used to check if a prefix was in the browse database. | 474 // Used to check if a prefix was in the browse database. |
| 479 base::FilePath browse_prefix_set_filename_; | 475 base::FilePath browse_prefix_set_filename_; |
| 480 scoped_ptr<safe_browsing::PrefixSet> browse_prefix_set_; | 476 scoped_ptr<safe_browsing::PrefixSet> browse_prefix_set_; |
| 481 | 477 |
| 482 // Used to check if a prefix was in the browse database. | 478 // Used to check if a prefix was in the browse database. |
| 483 base::FilePath side_effect_free_whitelist_prefix_set_filename_; | 479 base::FilePath side_effect_free_whitelist_prefix_set_filename_; |
| 484 scoped_ptr<safe_browsing::PrefixSet> side_effect_free_whitelist_prefix_set_; | 480 scoped_ptr<safe_browsing::PrefixSet> side_effect_free_whitelist_prefix_set_; |
| 485 }; | 481 }; |
| 486 | 482 |
| 487 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 483 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
| OLD | NEW |