diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 01:48:43 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 01:48:43 +0000 |
commit | 88cf329e3b89404544ad80a70a5a0a325e420227 (patch) | |
tree | 0c85964dc730d4d686fa350b1673dd23977c598f | |
parent | 40e0486b7052e76db03134a44cead2baf6ae528f (diff) | |
download | chromium_src-88cf329e3b89404544ad80a70a5a0a325e420227.zip chromium_src-88cf329e3b89404544ad80a70a5a0a325e420227.tar.gz chromium_src-88cf329e3b89404544ad80a70a5a0a325e420227.tar.bz2 |
More NotificationRegistrar conversions.
BUG=2381
Review URL: http://codereview.chromium.org/115675
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16701 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/profile.cc | 20 | ||||
-rw-r--r-- | chrome/browser/profile.h | 4 |
2 files changed, 9 insertions, 15 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index 2ca2342..1ef234c 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -111,20 +111,14 @@ class OffTheRecordProfileImpl : public Profile, // Register for browser close notifications so we can detect when the last // off-the-record window is closed, in which case we can clean our states // (cookies, downloads...). - NotificationService::current()->AddObserver( - this, - NotificationType::BROWSER_CLOSED, - NotificationService::AllSources()); + registrar_.Add(this, NotificationType::BROWSER_CLOSED, + NotificationService::AllSources()); } virtual ~OffTheRecordProfileImpl() { CleanupRequestContext(request_context_); CleanupRequestContext(media_request_context_); CleanupRequestContext(extensions_request_context_); - NotificationService::current()->RemoveObserver( - this, - NotificationType::BROWSER_CLOSED, - NotificationService::AllSources()); } virtual FilePath GetPath() { return profile_->GetPath(); } @@ -375,6 +369,8 @@ class OffTheRecordProfileImpl : public Profile, } private: + NotificationRegistrar registrar_; + // The real underlying profile. Profile* profile_; @@ -445,8 +441,8 @@ ProfileImpl::ProfileImpl(const FilePath& path) #endif // Listen for theme installation. - NotificationService::current()->AddObserver(this, - NotificationType::THEME_INSTALLED, NotificationService::AllSources()); + registrar_.Add(this, NotificationType::THEME_INSTALLED, + NotificationService::AllSources()); } void ProfileImpl::InitExtensions() { @@ -515,10 +511,6 @@ ProfileImpl::~ProfileImpl() { personalization_.reset(); #endif - // Remove theme observer. - NotificationService::current()->RemoveObserver(this, - NotificationType::THEME_INSTALLED, NotificationService::AllSources()); - // Both HistoryService and WebDataService maintain threads for background // processing. Its possible each thread still has tasks on it that have // increased the ref count of the service. In such a situation, when we diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h index be775c2..1ee1a19 100644 --- a/chrome/browser/profile.h +++ b/chrome/browser/profile.h @@ -18,7 +18,7 @@ #ifdef CHROME_PERSONALIZATION #include "chrome/personalization/personalization.h" #endif -#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" namespace net { class ForceTLSState; @@ -374,6 +374,8 @@ class ProfileImpl : public Profile, // spellchecker to the resource message filters. void InitializeSpellChecker(bool need_to_broadcast); + NotificationRegistrar registrar_; + FilePath path_; scoped_ptr<VisitedLinkMaster> visited_link_master_; scoped_refptr<ExtensionsService> extensions_service_; |