diff options
| author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 02:26:17 +0000 |
|---|---|---|
| committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 02:26:17 +0000 |
| commit | d4a749b4e6b30a76e51cb53cc68204f42635cef1 (patch) | |
| tree | bc9a19a7913a870ac325cf519f5f971abbb70248 /chrome/views | |
| parent | 4e7571400dadada346819e8fa9a9ca7c0bf0d673 (diff) | |
| download | chromium_src-d4a749b4e6b30a76e51cb53cc68204f42635cef1.zip chromium_src-d4a749b4e6b30a76e51cb53cc68204f42635cef1.tar.gz chromium_src-d4a749b4e6b30a76e51cb53cc68204f42635cef1.tar.bz2 | |
use a registrar to safely remove observer
TBR=evan
Review URL: http://codereview.chromium.org/18442
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
| -rw-r--r-- | chrome/views/window.cc | 6 | ||||
| -rw-r--r-- | chrome/views/window.h | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/chrome/views/window.cc b/chrome/views/window.cc index 699d9da..5101efa 100644 --- a/chrome/views/window.cc +++ b/chrome/views/window.cc @@ -34,10 +34,6 @@ static const int kMonitorEdgePadding = 10; // Window, public: Window::~Window() { - if (!IsAppWindow()) { - NotificationService::current()->RemoveObserver( - this, NOTIFY_ALL_APPWINDOWS_CLOSED, NotificationService::AllSources()); - } } // static @@ -297,7 +293,7 @@ void Window::Init(HWND parent, const gfx::Rect& bounds) { InitAlwaysOnTopState(); if (!IsAppWindow()) { - NotificationService::current()->AddObserver( + notification_registrar_.Add( this, NOTIFY_ALL_APPWINDOWS_CLOSED, NotificationService::AllSources()); } } diff --git a/chrome/views/window.h b/chrome/views/window.h index c1c097f..1a3e9ab 100644 --- a/chrome/views/window.h +++ b/chrome/views/window.h @@ -5,7 +5,7 @@ #ifndef CHROME_VIEWS_WINDOW_H__ #define CHROME_VIEWS_WINDOW_H__ -#include "chrome/common/notification_service.h" +#include "chrome/common/notification_registrar.h" #include "chrome/views/widget_win.h" namespace gfx { @@ -267,6 +267,9 @@ class Window : public WidgetWin, // that explains why we save this. bool saved_maximized_state_; + // Hold onto notifications. + NotificationRegistrar notification_registrar_; + DISALLOW_EVIL_CONSTRUCTORS(Window); }; |
