| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_PRIVACY_BLACKLIST_BLACKLIST_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_MANAGER_H_ | 6 #define CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 friend class ChromeThread; | 65 friend class ChromeThread; |
| 66 friend class DeleteTask<BlacklistManager>; | 66 friend class DeleteTask<BlacklistManager>; |
| 67 | 67 |
| 68 virtual ~BlacklistManager(); | 68 virtual ~BlacklistManager(); |
| 69 | 69 |
| 70 // Compile all persistent blacklists to one binary blacklist stored on disk. | 70 // Compile all persistent blacklists to one binary blacklist stored on disk. |
| 71 void CompileBlacklist(); | 71 void CompileBlacklist(); |
| 72 void DoCompileBlacklist(const std::vector<FilePath>& source_blacklists); | 72 void DoCompileBlacklist(const std::vector<FilePath>& source_blacklists); |
| 73 void OnBlacklistCompilationReadErrors(const std::vector<string16>& errors); |
| 73 void OnBlacklistCompilationFinished(bool success); | 74 void OnBlacklistCompilationFinished(bool success); |
| 74 | 75 |
| 75 // Read all blacklists from disk (the compiled one and also the transient | 76 // Read all blacklists from disk (the compiled one and also the transient |
| 76 // blacklists). In case of failure, if we haven't loaded any blacklist yet, | 77 // blacklists). In case of failure, if we haven't loaded any blacklist yet, |
| 77 // we'll compile the blacklist and try to read it again. | 78 // we'll compile the blacklist and try to read it again. |
| 78 void ReadBlacklist(); | 79 void ReadBlacklist(); |
| 79 void DoReadBlacklist(const std::vector<FilePath>& transient_blacklists); | 80 void DoReadBlacklist(const std::vector<FilePath>& transient_blacklists); |
| 80 void UpdatePublishedCompiledBlacklist(Blacklist* blacklist); | 81 void UpdatePublishedCompiledBlacklist(Blacklist* blacklist); |
| 81 void OnBlacklistReadFinished(bool success); | 82 void OnBlacklistReadFinished(bool success); |
| 82 | 83 |
| 84 // Sets the |compiled_blacklist_| to NULL to indicate that the blacklist is |
| 85 // not ready. |
| 86 void ResetPublishedCompiledBlacklist(); |
| 87 |
| 83 // True after the first blacklist read has finished (regardless of success). | 88 // True after the first blacklist read has finished (regardless of success). |
| 84 // Used to avoid an infinite loop. | 89 // Used to avoid an infinite loop. |
| 85 bool first_read_finished_; | 90 bool first_read_finished_; |
| 86 | 91 |
| 87 Profile* profile_; | 92 Profile* profile_; |
| 88 | 93 |
| 89 // Path where we store the compiled blacklist. | 94 // Path where we store the compiled blacklist. |
| 90 FilePath compiled_blacklist_path_; | 95 FilePath compiled_blacklist_path_; |
| 91 | 96 |
| 92 // Keep the compiled blacklist object in memory. | 97 // Keep the compiled blacklist object in memory. |
| 93 scoped_ptr<Blacklist> compiled_blacklist_; | 98 scoped_ptr<Blacklist> compiled_blacklist_; |
| 94 | 99 |
| 95 BlacklistPathProvider* path_provider_; | 100 BlacklistPathProvider* path_provider_; |
| 96 | 101 |
| 97 NotificationRegistrar registrar_; | 102 NotificationRegistrar registrar_; |
| 98 | 103 |
| 99 DISALLOW_COPY_AND_ASSIGN(BlacklistManager); | 104 DISALLOW_COPY_AND_ASSIGN(BlacklistManager); |
| 100 }; | 105 }; |
| 101 | 106 |
| 102 #endif // CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_MANAGER_H_ | 107 #endif // CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_MANAGER_H_ |
| OLD | NEW |