summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/tab_contents_container_view.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-24 17:01:11 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-24 17:01:11 +0000
commit8f5b58f1daabaa3b02499043e3c01ae5d05aaf7b (patch)
tree85443aa44fb4c17fc666c2624c87aabc858e7d79 /chrome/browser/views/tab_contents_container_view.cc
parent44903a076984c27d2fe98ac872a455cefd01aa51 (diff)
downloadchromium_src-8f5b58f1daabaa3b02499043e3c01ae5d05aaf7b.zip
chromium_src-8f5b58f1daabaa3b02499043e3c01ae5d05aaf7b.tar.gz
chromium_src-8f5b58f1daabaa3b02499043e3c01ae5d05aaf7b.tar.bz2
Use the NotificationRegistrar for the remaining TAB_CONTENTS_DESTROYED
notifications to see if it can fix a crash. Review URL: http://codereview.chromium.org/92129 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tab_contents_container_view.cc')
-rw-r--r--chrome/browser/views/tab_contents_container_view.cc35
1 files changed, 11 insertions, 24 deletions
diff --git a/chrome/browser/views/tab_contents_container_view.cc b/chrome/browser/views/tab_contents_container_view.cc
index 04c9354..c0089a7 100644
--- a/chrome/browser/views/tab_contents_container_view.cc
+++ b/chrome/browser/views/tab_contents_container_view.cc
@@ -174,33 +174,20 @@ void TabContentsContainerView::Observe(NotificationType type,
}
void TabContentsContainerView::AddObservers() {
- DCHECK(tab_contents_);
- if (tab_contents_->AsWebContents()) {
- // WebContents can change their RenderViewHost and hence the HWND that is
- // shown and getting focused. We need to keep track of that so we install
- // the focus subclass on the shown HWND so we intercept focus change events.
- NotificationService::current()->AddObserver(
- this, NotificationType::RENDER_VIEW_HOST_CHANGED,
- Source<NavigationController>(&tab_contents_->controller()));
- }
- NotificationService::current()->AddObserver(
- this,
- NotificationType::TAB_CONTENTS_DESTROYED,
- Source<TabContents>(tab_contents_));
+ // WebContents can change their RenderViewHost and hence the HWND that is
+ // shown and getting focused. We need to keep track of that so we install
+ // the focus subclass on the shown HWND so we intercept focus change events.
+ registrar_.Add(this,
+ NotificationType::RENDER_VIEW_HOST_CHANGED,
+ Source<NavigationController>(&tab_contents_->controller()));
+
+ registrar_.Add(this,
+ NotificationType::TAB_CONTENTS_DESTROYED,
+ Source<TabContents>(tab_contents_));
}
void TabContentsContainerView::RemoveObservers() {
- DCHECK(tab_contents_);
- if (tab_contents_->AsWebContents()) {
- NotificationService::current()->RemoveObserver(
- this,
- NotificationType::RENDER_VIEW_HOST_CHANGED,
- Source<NavigationController>(&tab_contents_->controller()));
- }
- NotificationService::current()->RemoveObserver(
- this,
- NotificationType::TAB_CONTENTS_DESTROYED,
- Source<TabContents>(tab_contents_));
+ registrar_.RemoveAll();
}
void TabContentsContainerView::RenderViewHostChanged(RenderViewHost* old_host,