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 | |
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')
-rw-r--r-- | chrome/browser/sessions/session_service.cc | 38 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service.h | 3 |
2 files changed, 26 insertions, 15 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, diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h index 7af43f0..1c3402d3 100644 --- a/chrome/browser/sessions/session_service.h +++ b/chrome/browser/sessions/session_service.h @@ -12,7 +12,6 @@ #include "chrome/browser/sessions/base_session_service.h" #include "chrome/browser/sessions/session_id.h" #include "chrome/common/notification_service.h" -#include "chrome/common/notification_registrar.h" class Browser; class NavigationController; @@ -306,8 +305,6 @@ class SessionService : public BaseSessionService, return type == Browser::TYPE_NORMAL; } - NotificationRegistrar registrar_; - // Maps from session tab id to the range of navigation entries that has // been written to disk. // |