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 <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "chrome/browser/safe_browsing/safe_browsing_store.h" | 16 #include "chrome/browser/safe_browsing/safe_browsing_store.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class Time; | 19 class MessageLoop; |
| 20 class Time; |
20 } | 21 } |
21 | 22 |
22 namespace safe_browsing { | 23 namespace safe_browsing { |
23 class PrefixSet; | 24 class PrefixSet; |
24 } | 25 } |
25 | 26 |
26 class GURL; | 27 class GURL; |
27 class MessageLoop; | |
28 class SafeBrowsingDatabase; | 28 class SafeBrowsingDatabase; |
29 | 29 |
30 // Factory for creating SafeBrowsingDatabase. Tests implement this factory | 30 // Factory for creating SafeBrowsingDatabase. Tests implement this factory |
31 // to create fake Databases for testing. | 31 // to create fake Databases for testing. |
32 class SafeBrowsingDatabaseFactory { | 32 class SafeBrowsingDatabaseFactory { |
33 public: | 33 public: |
34 SafeBrowsingDatabaseFactory() { } | 34 SafeBrowsingDatabaseFactory() { } |
35 virtual ~SafeBrowsingDatabaseFactory() { } | 35 virtual ~SafeBrowsingDatabaseFactory() { } |
36 virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( | 36 virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( |
37 bool enable_download_protection, | 37 bool enable_download_protection, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 int64 UpdateHashPrefixStore(const base::FilePath& store_filename, | 337 int64 UpdateHashPrefixStore(const base::FilePath& store_filename, |
338 SafeBrowsingStore* store, | 338 SafeBrowsingStore* store, |
339 FailureType failure_type); | 339 FailureType failure_type); |
340 void UpdateBrowseStore(); | 340 void UpdateBrowseStore(); |
341 void UpdateWhitelistStore(const base::FilePath& store_filename, | 341 void UpdateWhitelistStore(const base::FilePath& store_filename, |
342 SafeBrowsingStore* store, | 342 SafeBrowsingStore* store, |
343 SBWhitelist* whitelist); | 343 SBWhitelist* whitelist); |
344 | 344 |
345 // Used to verify that various calls are made from the thread the | 345 // Used to verify that various calls are made from the thread the |
346 // object was created on. | 346 // object was created on. |
347 MessageLoop* creation_loop_; | 347 base::MessageLoop* creation_loop_; |
348 | 348 |
349 // Lock for protecting access to variables that may be used on the | 349 // Lock for protecting access to variables that may be used on the |
350 // IO thread. This includes |prefix_set_|, |full_browse_hashes_|, | 350 // IO thread. This includes |prefix_set_|, |full_browse_hashes_|, |
351 // |pending_browse_hashes_|, |prefix_miss_cache_|, |csd_whitelist_|, | 351 // |pending_browse_hashes_|, |prefix_miss_cache_|, |csd_whitelist_|, |
352 // and |csd_whitelist_all_urls_|. | 352 // and |csd_whitelist_all_urls_|. |
353 base::Lock lookup_lock_; | 353 base::Lock lookup_lock_; |
354 | 354 |
355 // Underlying persistent store for chunk data. | 355 // Underlying persistent store for chunk data. |
356 // For browsing related (phishing and malware URLs) chunks and prefixes. | 356 // For browsing related (phishing and malware URLs) chunks and prefixes. |
357 base::FilePath browse_filename_; | 357 base::FilePath browse_filename_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // Set to true if any chunks are added or deleted during an update. | 403 // Set to true if any chunks are added or deleted during an update. |
404 // Used to optimize away database update. | 404 // Used to optimize away database update. |
405 bool change_detected_; | 405 bool change_detected_; |
406 | 406 |
407 // Used to check if a prefix was in the database. | 407 // Used to check if a prefix was in the database. |
408 base::FilePath prefix_set_filename_; | 408 base::FilePath prefix_set_filename_; |
409 scoped_ptr<safe_browsing::PrefixSet> prefix_set_; | 409 scoped_ptr<safe_browsing::PrefixSet> prefix_set_; |
410 }; | 410 }; |
411 | 411 |
412 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 412 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
OLD | NEW |