diff options
Diffstat (limited to 'chrome/browser/tab_contents.cc')
-rw-r--r-- | chrome/browser/tab_contents.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/chrome/browser/tab_contents.cc b/chrome/browser/tab_contents.cc index 8e93672..66774c6 100644 --- a/chrome/browser/tab_contents.cc +++ b/chrome/browser/tab_contents.cc @@ -66,7 +66,6 @@ void TabContents::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kBlockPopups, false); } - void TabContents::CloseContents() { // Destroy our NavigationController, which will Destroy all tabs it owns. controller_->Destroy(); @@ -410,9 +409,9 @@ void TabContents::AddInfoBar(InfoBarDelegate* delegate) { // added. We use this notification to expire InfoBars that need to expire on // page transitions. if (infobar_delegates_.size() == 1) { - NotificationService::current()->AddObserver( - this, NOTIFY_NAV_ENTRY_COMMITTED, - Source<NavigationController>(controller())); + DCHECK(controller()); + registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED, + Source<NavigationController>(controller())); } } @@ -425,13 +424,12 @@ void TabContents::RemoveInfoBar(InfoBarDelegate* delegate) { Source<TabContents>(this), Details<InfoBarDelegate>(delegate)); infobar_delegates_.erase(it); - } - // Remove ourselves as an observer if we are tracking no more InfoBars. - if (infobar_delegates_.empty()) { - NotificationService::current()->RemoveObserver( - this, NOTIFY_NAV_ENTRY_COMMITTED, - Source<NavigationController>(controller())); + // Remove ourselves as an observer if we are tracking no more InfoBars. + if (infobar_delegates_.empty()) { + registrar_.Remove(this, NOTIFY_NAV_ENTRY_COMMITTED, + Source<NavigationController>(controller())); + } } } |