diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 01:53:02 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 01:53:02 +0000 |
commit | f987e3dacf6a2aa203f0f7b9d6e9b01c2e782fcc (patch) | |
tree | 397319f808ac259410320aa28ed26e1979ad6a58 /chrome/browser/find_bar_controller.cc | |
parent | f1c8a2bde28415af7f2af63bfeaa7bc4b781e6d0 (diff) | |
download | chromium_src-f987e3dacf6a2aa203f0f7b9d6e9b01c2e782fcc.zip chromium_src-f987e3dacf6a2aa203f0f7b9d6e9b01c2e782fcc.tar.gz chromium_src-f987e3dacf6a2aa203f0f7b9d6e9b01c2e782fcc.tar.bz2 |
Use a NotificationRegistrar to listen for notifications.
BUG=2381
Review URL: http://codereview.chromium.org/114039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/find_bar_controller.cc')
-rw-r--r-- | chrome/browser/find_bar_controller.cc | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/chrome/browser/find_bar_controller.cc b/chrome/browser/find_bar_controller.cc index 2d1a457..173cedc 100644 --- a/chrome/browser/find_bar_controller.cc +++ b/chrome/browser/find_bar_controller.cc @@ -17,8 +17,6 @@ FindBarController::FindBarController(FindBar* find_bar) } FindBarController::~FindBarController() { - // Web contents should have been NULLed out. If not, then we're leaking - // notification observers. DCHECK(!tab_contents_); } @@ -52,12 +50,7 @@ void FindBarController::EndFindSession() { void FindBarController::ChangeTabContents(TabContents* contents) { if (tab_contents_) { - NotificationService::current()->RemoveObserver( - this, NotificationType::FIND_RESULT_AVAILABLE, - Source<TabContents>(tab_contents_)); - NotificationService::current()->RemoveObserver( - this, NotificationType::NAV_ENTRY_COMMITTED, - Source<NavigationController>(&tab_contents_->controller())); + registrar_.RemoveAll(); find_bar_->StopAnimation(); } @@ -73,12 +66,10 @@ void FindBarController::ChangeTabContents(TabContents* contents) { if (!tab_contents_) return; - NotificationService::current()->AddObserver( - this, NotificationType::FIND_RESULT_AVAILABLE, - Source<TabContents>(tab_contents_)); - NotificationService::current()->AddObserver( - this, NotificationType::NAV_ENTRY_COMMITTED, - Source<NavigationController>(&tab_contents_->controller())); + registrar_.Add(this, NotificationType::FIND_RESULT_AVAILABLE, + Source<TabContents>(tab_contents_)); + registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + Source<NavigationController>(&tab_contents_->controller())); // Find out what we should show in the find text box. Usually, this will be // the last search in this tab, but if no search has been issued in this tab |