diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-06 04:50:52 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-06 04:50:52 +0000 |
commit | 1061321d6cd733eae7633bde7deb5eb1d6cbf3d0 (patch) | |
tree | 2ed062b45e39e049b73bdd6cfaea8ffc397479bd /chrome/browser/sessions/session_service.cc | |
parent | dd5684a027e4a3b2d74cb9eeebfb039171008503 (diff) | |
download | chromium_src-1061321d6cd733eae7633bde7deb5eb1d6cbf3d0.zip chromium_src-1061321d6cd733eae7633bde7deb5eb1d6cbf3d0.tar.gz chromium_src-1061321d6cd733eae7633bde7deb5eb1d6cbf3d0.tar.bz2 |
Reverting 7581.
Review URL: http://codereview.chromium.org/17069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7582 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sessions/session_service.cc')
-rw-r--r-- | chrome/browser/sessions/session_service.cc | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 227c6ff..6016651 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -126,6 +126,20 @@ SessionService::SessionService(const std::wstring& save_path) SessionService::~SessionService() { Save(); + + // Unregister our notifications. + NotificationService::current()->RemoveObserver( + this, NOTIFY_TAB_PARENTED, NotificationService::AllSources()); + NotificationService::current()->RemoveObserver( + this, NOTIFY_TAB_CLOSED, NotificationService::AllSources()); + NotificationService::current()->RemoveObserver( + this, NOTIFY_NAV_LIST_PRUNED, NotificationService::AllSources()); + NotificationService::current()->RemoveObserver( + this, NOTIFY_NAV_ENTRY_CHANGED, NotificationService::AllSources()); + NotificationService::current()->RemoveObserver( + this, NOTIFY_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); + NotificationService::current()->RemoveObserver( + this, NOTIFY_BROWSER_OPENED, NotificationService::AllSources()); } void SessionService::ResetFromCurrentBrowsers() { @@ -366,18 +380,18 @@ SessionService::Handle SessionService::GetLastSession( void SessionService::Init() { // Register for the notifications we're interested in. - registrar_.Add(this, NOTIFY_TAB_PARENTED, - NotificationService::AllSources()); - registrar_.Add(this, NOTIFY_TAB_CLOSED, - NotificationService::AllSources()); - registrar_.Add(this, NOTIFY_NAV_LIST_PRUNED, - NotificationService::AllSources()); - registrar_.Add(this, NOTIFY_NAV_ENTRY_CHANGED, - NotificationService::AllSources()); - registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED, - NotificationService::AllSources()); - registrar_.Add(this, NOTIFY_BROWSER_OPENED, - NotificationService::AllSources()); + NotificationService::current()->AddObserver( + this, NOTIFY_TAB_PARENTED, NotificationService::AllSources()); + NotificationService::current()->AddObserver( + this, NOTIFY_TAB_CLOSED, NotificationService::AllSources()); + NotificationService::current()->AddObserver( + this, NOTIFY_NAV_LIST_PRUNED, NotificationService::AllSources()); + NotificationService::current()->AddObserver( + this, NOTIFY_NAV_ENTRY_CHANGED, NotificationService::AllSources()); + NotificationService::current()->AddObserver( + this, NOTIFY_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); + NotificationService::current()->AddObserver( + this, NOTIFY_BROWSER_OPENED, NotificationService::AllSources()); } void SessionService::Observe(NotificationType type, |