summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 01:48:43 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 01:48:43 +0000
commit88cf329e3b89404544ad80a70a5a0a325e420227 (patch)
tree0c85964dc730d4d686fa350b1673dd23977c598f /chrome/browser/profile.cc
parent40e0486b7052e76db03134a44cead2baf6ae528f (diff)
downloadchromium_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
Diffstat (limited to 'chrome/browser/profile.cc')
-rw-r--r--chrome/browser/profile.cc20
1 files changed, 6 insertions, 14 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