summaryrefslogtreecommitdiffstats
path: root/chrome/browser/jsmessage_box_handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/jsmessage_box_handler.cc')
-rw-r--r--chrome/browser/jsmessage_box_handler.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc
index 2a1d2fd..b86920b 100644
--- a/chrome/browser/jsmessage_box_handler.cc
+++ b/chrome/browser/jsmessage_box_handler.cc
@@ -37,6 +37,12 @@ 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());
}
//////////////////////////////////////////////////////////////////////////////
@@ -203,8 +209,11 @@ JavascriptMessageBoxHandler::JavascriptMessageBoxHandler(
// Make sure we get navigation notifications so we know when our parent
// contents will disappear or navigate to a different page.
- registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED,
- NotificationService::AllSources());
- registrar_.Add(this, NOTIFY_TAB_CONTENTS_DESTROYED,
- NotificationService::AllSources());
+ NotificationService::current()->
+ AddObserver(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ NotificationService::AllSources());
+ NotificationService::current()->
+ AddObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED,
+ NotificationService::AllSources());
}
+