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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 SafeBrowsingStore* csd_whitelist_store, | 280 SafeBrowsingStore* csd_whitelist_store, |
281 SafeBrowsingStore* download_whitelist_store, | 281 SafeBrowsingStore* download_whitelist_store, |
282 SafeBrowsingStore* extension_blacklist_store, | 282 SafeBrowsingStore* extension_blacklist_store, |
283 SafeBrowsingStore* side_effect_free_whitelist_store, | 283 SafeBrowsingStore* side_effect_free_whitelist_store, |
284 SafeBrowsingStore* ip_blacklist_store); | 284 SafeBrowsingStore* ip_blacklist_store); |
285 | 285 |
286 // Create a database with a browse store. This is a legacy interface that | 286 // Create a database with a browse store. This is a legacy interface that |
287 // useds Sqlite. | 287 // useds Sqlite. |
288 SafeBrowsingDatabaseNew(); | 288 SafeBrowsingDatabaseNew(); |
289 | 289 |
290 virtual ~SafeBrowsingDatabaseNew(); | 290 ~SafeBrowsingDatabaseNew() override; |
291 | 291 |
292 // Implement SafeBrowsingDatabase interface. | 292 // Implement SafeBrowsingDatabase interface. |
293 virtual void Init(const base::FilePath& filename) override; | 293 void Init(const base::FilePath& filename) override; |
294 virtual bool ResetDatabase() override; | 294 bool ResetDatabase() override; |
295 virtual bool ContainsBrowseUrl( | 295 bool ContainsBrowseUrl(const GURL& url, |
296 const GURL& url, | 296 std::vector<SBPrefix>* prefix_hits, |
297 std::vector<SBPrefix>* prefix_hits, | 297 std::vector<SBFullHashResult>* cache_hits) override; |
298 std::vector<SBFullHashResult>* cache_hits) override; | 298 bool ContainsDownloadUrl(const std::vector<GURL>& urls, |
299 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, | 299 std::vector<SBPrefix>* prefix_hits) override; |
300 std::vector<SBPrefix>* prefix_hits) override; | 300 bool ContainsCsdWhitelistedUrl(const GURL& url) override; |
301 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) override; | 301 bool ContainsDownloadWhitelistedUrl(const GURL& url) override; |
302 virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) override; | 302 bool ContainsDownloadWhitelistedString(const std::string& str) override; |
303 virtual bool ContainsDownloadWhitelistedString( | 303 bool ContainsExtensionPrefixes(const std::vector<SBPrefix>& prefixes, |
304 const std::string& str) override; | 304 std::vector<SBPrefix>* prefix_hits) override; |
305 virtual bool ContainsExtensionPrefixes( | 305 bool ContainsSideEffectFreeWhitelistUrl(const GURL& url) override; |
306 const std::vector<SBPrefix>& prefixes, | 306 bool ContainsMalwareIP(const std::string& ip_address) override; |
307 std::vector<SBPrefix>* prefix_hits) override; | 307 bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override; |
308 virtual bool ContainsSideEffectFreeWhitelistUrl(const GURL& url) override; | 308 void InsertChunks(const std::string& list_name, |
309 virtual bool ContainsMalwareIP(const std::string& ip_address) override; | 309 const std::vector<SBChunkData*>& chunks) override; |
310 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override; | 310 void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes) override; |
311 virtual void InsertChunks(const std::string& list_name, | 311 void UpdateFinished(bool update_succeeded) override; |
312 const std::vector<SBChunkData*>& chunks) override; | 312 void CacheHashResults(const std::vector<SBPrefix>& prefixes, |
313 virtual void DeleteChunks( | 313 const std::vector<SBFullHashResult>& full_hits, |
314 const std::vector<SBChunkDelete>& chunk_deletes) override; | 314 const base::TimeDelta& cache_lifetime) override; |
315 virtual void UpdateFinished(bool update_succeeded) override; | |
316 virtual void CacheHashResults( | |
317 const std::vector<SBPrefix>& prefixes, | |
318 const std::vector<SBFullHashResult>& full_hits, | |
319 const base::TimeDelta& cache_lifetime) override; | |
320 | 315 |
321 // Returns the value of malware_kill_switch_; | 316 // Returns the value of malware_kill_switch_; |
322 virtual bool IsMalwareIPMatchKillSwitchOn() override; | 317 bool IsMalwareIPMatchKillSwitchOn() override; |
323 | 318 |
324 // Returns true if the CSD whitelist has everything whitelisted. | 319 // Returns true if the CSD whitelist has everything whitelisted. |
325 virtual bool IsCsdWhitelistKillSwitchOn() override; | 320 bool IsCsdWhitelistKillSwitchOn() override; |
326 | 321 |
327 private: | 322 private: |
328 friend class SafeBrowsingDatabaseTest; | 323 friend class SafeBrowsingDatabaseTest; |
329 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, HashCaching); | 324 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, HashCaching); |
330 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, CachedFullMiss); | 325 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, CachedFullMiss); |
331 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, CachedPrefixHitFullMiss); | 326 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, CachedPrefixHitFullMiss); |
332 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, BrowseFullHashMatching); | 327 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, BrowseFullHashMatching); |
333 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, | 328 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, |
334 BrowseFullHashAndPrefixMatching); | 329 BrowseFullHashAndPrefixMatching); |
335 | 330 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 scoped_ptr<safe_browsing::PrefixSet> browse_prefix_set_; | 464 scoped_ptr<safe_browsing::PrefixSet> browse_prefix_set_; |
470 | 465 |
471 // Used to check if a prefix was in the browse database. | 466 // Used to check if a prefix was in the browse database. |
472 scoped_ptr<safe_browsing::PrefixSet> side_effect_free_whitelist_prefix_set_; | 467 scoped_ptr<safe_browsing::PrefixSet> side_effect_free_whitelist_prefix_set_; |
473 | 468 |
474 // Used to schedule resetting the database because of corruption. | 469 // Used to schedule resetting the database because of corruption. |
475 base::WeakPtrFactory<SafeBrowsingDatabaseNew> reset_factory_; | 470 base::WeakPtrFactory<SafeBrowsingDatabaseNew> reset_factory_; |
476 }; | 471 }; |
477 | 472 |
478 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 473 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
OLD | NEW |