| 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 COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ | 8 #ifndef COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ |
| 9 #define COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ | 9 #define COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 virtual void OnCheckDownloadUrlResult(const std::vector<GURL>& url_chain, | 42 virtual void OnCheckDownloadUrlResult(const std::vector<GURL>& url_chain, |
| 43 SBThreatType threat_type) {} | 43 SBThreatType threat_type) {} |
| 44 | 44 |
| 45 // Called when the result of checking a set of extensions is known. | 45 // Called when the result of checking a set of extensions is known. |
| 46 virtual void OnCheckExtensionsResult( | 46 virtual void OnCheckExtensionsResult( |
| 47 const std::set<std::string>& threats) {} | 47 const std::set<std::string>& threats) {} |
| 48 | 48 |
| 49 // Called when the result of checking the API blacklist is known. | 49 // Called when the result of checking the API blacklist is known. |
| 50 virtual void OnCheckApiBlacklistUrlResult(const GURL& url, | 50 virtual void OnCheckApiBlacklistUrlResult(const GURL& url, |
| 51 const std::string& metadata) {} | 51 const std::string& metadata) {} |
| 52 |
| 53 // Called when the result of checking the resource blacklist is known. |
| 54 virtual void OnCheckResourceUrlResult(const GURL& url, |
| 55 SBThreatType threat_type, |
| 56 const std::string& threat_hash) {} |
| 52 }; | 57 }; |
| 53 | 58 |
| 54 | 59 |
| 55 // Returns true if URL-checking is supported on this build+device. | 60 // Returns true if URL-checking is supported on this build+device. |
| 56 // If false, calls to CheckBrowseUrl may dcheck-fail. | 61 // If false, calls to CheckBrowseUrl may dcheck-fail. |
| 57 virtual bool IsSupported() const = 0; | 62 virtual bool IsSupported() const = 0; |
| 58 | 63 |
| 59 // Returns the ThreatSource for this implementation. | 64 // Returns the ThreatSource for this implementation. |
| 60 virtual ThreatSource GetThreatSource() const = 0; | 65 virtual ThreatSource GetThreatSource() const = 0; |
| 61 | 66 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 83 // Result will be passed to callback in |client|. | 88 // Result will be passed to callback in |client|. |
| 84 virtual bool CheckDownloadUrl(const std::vector<GURL>& url_chain, | 89 virtual bool CheckDownloadUrl(const std::vector<GURL>& url_chain, |
| 85 Client* client) = 0; | 90 Client* client) = 0; |
| 86 | 91 |
| 87 // Check which prefixes in |extension_ids| are in the safebrowsing blacklist. | 92 // Check which prefixes in |extension_ids| are in the safebrowsing blacklist. |
| 88 // Returns true if not, false if further checks need to be made in which case | 93 // Returns true if not, false if further checks need to be made in which case |
| 89 // the result will be passed to |client|. | 94 // the result will be passed to |client|. |
| 90 virtual bool CheckExtensionIDs(const std::set<std::string>& extension_ids, | 95 virtual bool CheckExtensionIDs(const std::set<std::string>& extension_ids, |
| 91 Client* client) = 0; | 96 Client* client) = 0; |
| 92 | 97 |
| 98 // Check if |url| is in the resources blacklist. Returns true if not, false |
| 99 // if further checks need to be made in which case the result will be passed |
| 100 // to callback in |client|. |
| 101 virtual bool CheckResourceUrl(const GURL& url, Client* client) = 0; |
| 102 |
| 93 // Check if the |url| matches any of the full-length hashes from the client- | 103 // Check if the |url| matches any of the full-length hashes from the client- |
| 94 // side phishing detection whitelist. Returns true if there was a match and | 104 // side phishing detection whitelist. Returns true if there was a match and |
| 95 // false otherwise. To make sure we are conservative we will return true if | 105 // false otherwise. To make sure we are conservative we will return true if |
| 96 // an error occurs. This method must be called on the IO thread. | 106 // an error occurs. This method must be called on the IO thread. |
| 97 virtual bool MatchCsdWhitelistUrl(const GURL& url) = 0; | 107 virtual bool MatchCsdWhitelistUrl(const GURL& url) = 0; |
| 98 | 108 |
| 99 // Check if the given IP address (either IPv4 or IPv6) matches the malware | 109 // Check if the given IP address (either IPv4 or IPv6) matches the malware |
| 100 // IP blacklist. | 110 // IP blacklist. |
| 101 virtual bool MatchMalwareIP(const std::string& ip_address) = 0; | 111 virtual bool MatchMalwareIP(const std::string& ip_address) = 0; |
| 102 | 112 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 157 |
| 148 protected: | 158 protected: |
| 149 virtual ~SafeBrowsingDatabaseManager() {} | 159 virtual ~SafeBrowsingDatabaseManager() {} |
| 150 | 160 |
| 151 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; | 161 friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; |
| 152 }; // class SafeBrowsingDatabaseManager | 162 }; // class SafeBrowsingDatabaseManager |
| 153 | 163 |
| 154 } // namespace safe_browsing | 164 } // namespace safe_browsing |
| 155 | 165 |
| 156 #endif // COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ | 166 #endif // COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ |
| OLD | NEW |