| 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 // The Safe Browsing service is responsible for downloading anti-phishing and | 5 // The Safe Browsing service is responsible for downloading anti-phishing and |
| 6 // anti-malware tables and checking urls against them. | 6 // anti-malware tables and checking urls against them. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ |
| 9 #define CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // Result will be passed to callback in |client|. | 130 // Result will be passed to callback in |client|. |
| 131 virtual bool CheckDownloadUrl(const std::vector<GURL>& url_chain, | 131 virtual bool CheckDownloadUrl(const std::vector<GURL>& url_chain, |
| 132 Client* client); | 132 Client* client); |
| 133 | 133 |
| 134 // Check which prefixes in |extension_ids| are in the safebrowsing blacklist. | 134 // Check which prefixes in |extension_ids| are in the safebrowsing blacklist. |
| 135 // Returns true if not, false if further checks need to be made in which case | 135 // Returns true if not, false if further checks need to be made in which case |
| 136 // the result will be passed to |client|. | 136 // the result will be passed to |client|. |
| 137 virtual bool CheckExtensionIDs(const std::set<std::string>& extension_ids, | 137 virtual bool CheckExtensionIDs(const std::set<std::string>& extension_ids, |
| 138 Client* client); | 138 Client* client); |
| 139 | 139 |
| 140 // Check if the given url is on the side-effect free whitelist. | |
| 141 // Can be called on any thread. Returns false if the check cannot be performed | |
| 142 // (e.g. because we are disabled or because of an invalid scheme in the URL). | |
| 143 // Otherwise, returns true if the URL is on the whitelist based on matching | |
| 144 // the hash prefix only (so there may be false positives). | |
| 145 virtual bool CheckSideEffectFreeWhitelistUrl(const GURL& url); | |
| 146 | |
| 147 // Check if the |url| matches any of the full-length hashes from the client- | 140 // Check if the |url| matches any of the full-length hashes from the client- |
| 148 // side phishing detection whitelist. Returns true if there was a match and | 141 // side phishing detection whitelist. Returns true if there was a match and |
| 149 // false otherwise. To make sure we are conservative we will return true if | 142 // false otherwise. To make sure we are conservative we will return true if |
| 150 // an error occurs. This method must be called on the IO thread. | 143 // an error occurs. This method must be called on the IO thread. |
| 151 virtual bool MatchCsdWhitelistUrl(const GURL& url); | 144 virtual bool MatchCsdWhitelistUrl(const GURL& url); |
| 152 | 145 |
| 153 // Check if the given IP address (either IPv4 or IPv6) matches the malware | 146 // Check if the given IP address (either IPv4 or IPv6) matches the malware |
| 154 // IP blacklist. | 147 // IP blacklist. |
| 155 virtual bool MatchMalwareIP(const std::string& ip_address); | 148 virtual bool MatchMalwareIP(const std::string& ip_address); |
| 156 | 149 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // Indicate if client-side phishing detection whitelist should be enabled | 370 // Indicate if client-side phishing detection whitelist should be enabled |
| 378 // or not. | 371 // or not. |
| 379 bool enable_csd_whitelist_; | 372 bool enable_csd_whitelist_; |
| 380 | 373 |
| 381 // Indicate if the download whitelist should be enabled or not. | 374 // Indicate if the download whitelist should be enabled or not. |
| 382 bool enable_download_whitelist_; | 375 bool enable_download_whitelist_; |
| 383 | 376 |
| 384 // Indicate if the extension blacklist should be enabled. | 377 // Indicate if the extension blacklist should be enabled. |
| 385 bool enable_extension_blacklist_; | 378 bool enable_extension_blacklist_; |
| 386 | 379 |
| 387 // Indicate if the side effect free whitelist should be enabled. | |
| 388 bool enable_side_effect_free_whitelist_; | |
| 389 | |
| 390 // Indicate if the csd malware IP blacklist should be enabled. | 380 // Indicate if the csd malware IP blacklist should be enabled. |
| 391 bool enable_ip_blacklist_; | 381 bool enable_ip_blacklist_; |
| 392 | 382 |
| 393 // Indicate if the unwanted software blacklist should be enabled. | 383 // Indicate if the unwanted software blacklist should be enabled. |
| 394 bool enable_unwanted_software_blacklist_; | 384 bool enable_unwanted_software_blacklist_; |
| 395 | 385 |
| 396 // The sequenced task runner for running safe browsing database operations. | 386 // The sequenced task runner for running safe browsing database operations. |
| 397 scoped_refptr<base::SequencedTaskRunner> safe_browsing_task_runner_; | 387 scoped_refptr<base::SequencedTaskRunner> safe_browsing_task_runner_; |
| 398 | 388 |
| 399 // Indicates if we're currently in an update cycle. | 389 // Indicates if we're currently in an update cycle. |
| 400 bool update_in_progress_; | 390 bool update_in_progress_; |
| 401 | 391 |
| 402 // When true, newly fetched chunks may not in the database yet since the | 392 // When true, newly fetched chunks may not in the database yet since the |
| 403 // database is still updating. | 393 // database is still updating. |
| 404 bool database_update_in_progress_; | 394 bool database_update_in_progress_; |
| 405 | 395 |
| 406 // Indicates if we're in the midst of trying to close the database. If this | 396 // Indicates if we're in the midst of trying to close the database. If this |
| 407 // is true, nothing on the IO thread should access the database. | 397 // is true, nothing on the IO thread should access the database. |
| 408 bool closing_database_; | 398 bool closing_database_; |
| 409 | 399 |
| 410 std::deque<QueuedCheck> queued_checks_; | 400 std::deque<QueuedCheck> queued_checks_; |
| 411 | 401 |
| 412 // Timeout to use for safe browsing checks. | 402 // Timeout to use for safe browsing checks. |
| 413 base::TimeDelta check_timeout_; | 403 base::TimeDelta check_timeout_; |
| 414 | 404 |
| 415 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager); | 405 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager); |
| 416 }; | 406 }; |
| 417 | 407 |
| 418 #endif // CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ | 408 #endif // CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ |
| OLD | NEW |