Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2562)

Unified Diff: chrome/browser/privacy_blacklist/blacklist_manager.h

Issue 371063: Integrate BlacklistManager with Profile. (Closed)
Patch Set: trybot fixes Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/privacy_blacklist/blacklist_manager.h
diff --git a/chrome/browser/privacy_blacklist/blacklist_manager.h b/chrome/browser/privacy_blacklist/blacklist_manager.h
index ad401f724cef90d7830b7dff5818794d8370e1ac..5d6e97b487f962ad07d18a0d2e9ce3d2602e90cf 100644
--- a/chrome/browser/privacy_blacklist/blacklist_manager.h
+++ b/chrome/browser/privacy_blacklist/blacklist_manager.h
@@ -19,11 +19,20 @@ class Profile;
class BlacklistPathProvider {
public:
- virtual ~BlacklistPathProvider();
+ // Returns true if the provider is ready (has loaded the blacklist paths
+ // and we can query them). Called on UI thread.
+ virtual bool AreBlacklistPathsReady() const = 0;
- // The methods below will be invoked on the UI thread.
+ // Returns paths that will still be there after browser shutdown
+ // (installed extensions). Called on UI thread.
virtual std::vector<FilePath> GetPersistentBlacklistPaths() = 0;
+
+ // Returns paths that will disappear after browser shutdown
+ // (unpacked extensions). Called on UI thread.
virtual std::vector<FilePath> GetTransientBlacklistPaths() = 0;
+
+ protected:
+ virtual ~BlacklistPathProvider();
};
// Updates one compiled binary blacklist based on a list of plaintext
@@ -33,13 +42,15 @@ class BlacklistManager
public base::RefCountedThreadSafe<BlacklistManager,
ChromeThread::DeleteOnUIThread> {
public:
- BlacklistManager();
- void Initialize(Profile* profile, BlacklistPathProvider* path_provider);
+ // Create BlacklistManager (must be done on UI thread).
+ BlacklistManager(Profile* profile, BlacklistPathProvider* path_provider);
+
+ // Initialize the BlacklistManager (on UI thread).
+ void Initialize();
- const Blacklist* GetCompiledBlacklist() const {
- // TODO(phajdan.jr): Determine on which thread this should be invoked (IO?).
- return compiled_blacklist_.get();
- }
+ // Returns compiled blacklist, or NULL if not ready. Only valid to call on IO
+ // thread.
+ const Blacklist* GetCompiledBlacklist() const;
// NotificationObserver
virtual void Observe(NotificationType type,
@@ -54,7 +65,7 @@ class BlacklistManager
friend class ChromeThread;
friend class DeleteTask<BlacklistManager>;
- ~BlacklistManager() {}
+ virtual ~BlacklistManager();
// Compile all persistent blacklists to one binary blacklist stored on disk.
void CompileBlacklist();
@@ -62,11 +73,12 @@ class BlacklistManager
void OnBlacklistCompilationFinished(bool success);
// Read all blacklists from disk (the compiled one and also the transient
- // blacklists).
+ // blacklists). In case of failure, if we haven't loaded any blacklist yet,
+ // we'll compile the blacklist and try to read it again.
void ReadBlacklist();
void DoReadBlacklist(const std::vector<FilePath>& transient_blacklists);
- void ReportBlacklistReadResult(Blacklist* blacklist);
- void OnBlacklistReadFinished(Blacklist* blacklist);
+ void UpdatePublishedCompiledBlacklist(Blacklist* blacklist);
+ void OnBlacklistReadFinished(bool success);
// True after the first blacklist read has finished (regardless of success).
// Used to avoid an infinite loop.
« no previous file with comments | « chrome/browser/net/chrome_url_request_context.cc ('k') | chrome/browser/privacy_blacklist/blacklist_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698