summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-30 16:11:27 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-30 16:11:27 +0000
commita307e31e82d2b9006802d4381dc5f3da2b993a8d (patch)
treee46d5b0b6ea59aa1fb7d47f917bc837b37dd88b8 /chrome/browser/profile.cc
parent48a74f65c7775737ccee06a34eb5f73a5172172f (diff)
downloadchromium_src-a307e31e82d2b9006802d4381dc5f3da2b993a8d.zip
chromium_src-a307e31e82d2b9006802d4381dc5f3da2b993a8d.tar.gz
chromium_src-a307e31e82d2b9006802d4381dc5f3da2b993a8d.tar.bz2
Integrate BlacklistManager with Profile.
Now each Profile has a BlacklistManager that maintains a compiled Blacklist for that Profile. The system does not yet pause user-initiated web requests until the blacklist system is ready. However, the code is not supposed to be ready, and is hidden behind a --enable-privacy-blacklists command-line flag. TEST=Covered by browser_test. BUG=21541 Review URL: http://codereview.chromium.org/371063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33290 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile.cc')
-rw-r--r--chrome/browser/profile.cc39
1 files changed, 16 insertions, 23 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 4204c8a..c32e1a9 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -32,7 +32,7 @@
#include "chrome/browser/net/ssl_config_service_manager.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/password_manager/password_store_default.h"
-#include "chrome/browser/privacy_blacklist/blacklist_io.h"
+#include "chrome/browser/privacy_blacklist/blacklist_manager.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/search_versus_navigate_classifier.h"
@@ -404,8 +404,8 @@ class OffTheRecordProfileImpl : public Profile,
return GetOriginalProfile()->GetSSLConfigService();
}
- virtual Blacklist* GetBlacklist() {
- return GetOriginalProfile()->GetBlacklist();
+ virtual BlacklistManager* GetBlacklistManager() {
+ return GetOriginalProfile()->GetBlacklistManager();
}
virtual SessionService* GetSessionService() {
@@ -570,7 +570,8 @@ ProfileImpl::ProfileImpl(const FilePath& path)
request_context_(NULL),
media_request_context_(NULL),
extensions_request_context_(NULL),
- blacklist_(NULL),
+ blacklist_manager_(NULL),
+ blacklist_manager_created_(false),
history_service_created_(false),
favicon_service_created_(false),
created_web_data_service_(false),
@@ -600,20 +601,6 @@ ProfileImpl::ProfileImpl(const FilePath& path)
prefs->AddPrefObserver(prefs::kEnableSpellCheck, this);
prefs->AddPrefObserver(prefs::kEnableAutoSpellCorrect, this);
- if (CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kPrivacyBlacklist)) {
- std::wstring option = CommandLine::ForCurrentProcess()->GetSwitchValue(
- switches::kPrivacyBlacklist);
-#if defined(OS_POSIX)
- FilePath path(WideToUTF8(option));
-#else
- FilePath path(option);
-#endif
- blacklist_.reset(new Blacklist);
- // TODO(phajdan.jr): Handle errors when reading blacklist.
- BlacklistIO::ReadBinary(blacklist_.get(), path);
- }
-
#if defined(OS_MACOSX)
// If the profile directory doesn't already have a cache directory and it
// is under ~/Library/Application Support, use a suitable cache directory
@@ -758,9 +745,6 @@ ProfileImpl::~ProfileImpl() {
CleanupRequestContext(media_request_context_);
CleanupRequestContext(extensions_request_context_);
- // When the request contexts are gone, the blacklist wont be needed anymore.
- blacklist_.reset();
-
// HistoryService may call into the BookmarkModel, as such we need to
// delete HistoryService before the BookmarkModel. The destructor for
// HistoryService will join with HistoryService's backend thread so that
@@ -972,8 +956,17 @@ net::SSLConfigService* ProfileImpl::GetSSLConfigService() {
return ssl_config_service_manager_->Get();
}
-Blacklist* ProfileImpl::GetBlacklist() {
- return blacklist_.get();
+BlacklistManager* ProfileImpl::GetBlacklistManager() {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnablePrivacyBlacklists)) {
+ return NULL;
+ }
+ if (!blacklist_manager_created_) {
+ blacklist_manager_created_ = true;
+ blacklist_manager_ = new BlacklistManager(this, GetExtensionsService());
+ blacklist_manager_->Initialize();
+ }
+ return blacklist_manager_.get();
}
HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) {