diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-06 16:58:03 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-06 16:58:03 +0000 |
commit | 6a02963e645852d8ce70b53aa6199ec1780f31c2 (patch) | |
tree | 7df60ab260a074368dbe29ad11f61344b218cac4 /chrome/browser/jsmessage_box_handler.cc | |
parent | 690a99c80e4fe4e6eda9010b88e4438f57912336 (diff) | |
download | chromium_src-6a02963e645852d8ce70b53aa6199ec1780f31c2.zip chromium_src-6a02963e645852d8ce70b53aa6199ec1780f31c2.tar.gz chromium_src-6a02963e645852d8ce70b53aa6199ec1780f31c2.tar.bz2 |
This is a redo of my previous notification registrar change. I saw a crash in handling NAV_ENTRY_COMMITTED, so am changing all consumers of this to use the registrar so that it is impossible to forget to unregister.
The difference is that in tab_contents I moved the removal code in RemoveInfoBar to only remove the listener if an infobar was actually removed.
Review URL: http://codereview.chromium.org/16534
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/jsmessage_box_handler.cc')
-rw-r--r-- | chrome/browser/jsmessage_box_handler.cc | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc index b86920b..2a1d2fd 100644 --- a/chrome/browser/jsmessage_box_handler.cc +++ b/chrome/browser/jsmessage_box_handler.cc @@ -37,12 +37,6 @@ void JavascriptMessageBoxHandler::RunJavascriptMessageBox( } JavascriptMessageBoxHandler::~JavascriptMessageBoxHandler() { - NotificationService::current()-> - RemoveObserver(this, NOTIFY_NAV_ENTRY_COMMITTED, - NotificationService::AllSources()); - NotificationService::current()-> - RemoveObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED, - NotificationService::AllSources()); } ////////////////////////////////////////////////////////////////////////////// @@ -209,11 +203,8 @@ JavascriptMessageBoxHandler::JavascriptMessageBoxHandler( // Make sure we get navigation notifications so we know when our parent // contents will disappear or navigate to a different page. - NotificationService::current()-> - AddObserver(this, NOTIFY_NAV_ENTRY_COMMITTED, - NotificationService::AllSources()); - NotificationService::current()-> - AddObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED, - NotificationService::AllSources()); + registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED, + NotificationService::AllSources()); + registrar_.Add(this, NOTIFY_TAB_CONTENTS_DESTROYED, + NotificationService::AllSources()); } - |