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

Unified Diff: chrome/browser/profile.cc

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
« no previous file with comments | « chrome/browser/profile.h ('k') | chrome/browser/renderer_host/resource_dispatcher_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profile.cc
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 4204c8ad3f44a4fa7d90abfc4642f36e76783091..c32e1a99943b3a5218f10ffecebe1806be49a948 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) {
« no previous file with comments | « chrome/browser/profile.h ('k') | chrome/browser/renderer_host/resource_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698