diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 23:20:48 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 23:20:48 +0000 |
commit | b618713c323f0a5e85fb53300719e8ff1cdb410b (patch) | |
tree | 6782542670381c37d6b64667268f092470c57efc /chrome/browser/password_manager | |
parent | 930eefad81129f1c8db7621f8a02e02b855adf90 (diff) | |
download | chromium_src-b618713c323f0a5e85fb53300719e8ff1cdb410b.zip chromium_src-b618713c323f0a5e85fb53300719e8ff1cdb410b.tar.gz chromium_src-b618713c323f0a5e85fb53300719e8ff1cdb410b.tar.bz2 |
Fix issue 6520 by ensuring that InfoBarClosed is called whenever a tab is closed or a navigation to a URL that is not supported by the current TabContentsType takes place by invoking it on all InfoBarDelegates from TabContents::Destroy(), which is the best least-common-denominator I've found for doing this work. Alternatively I could have made InfoBarDelegate listen for TAB_CONTENTS_DESTROYED and self-invoke InfoBarClosed but that seemed unorthodox (relatively speaking).
This prevents InfoBarDelegates from leaking in these cases.
BUG=6520
Review URL: http://codereview.chromium.org/18381
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8406 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/password_manager')
-rw-r--r-- | chrome/browser/password_manager/password_manager.cc | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index 8756a34..87ed5f2 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -25,15 +25,12 @@ // login is one we already know about, the end of the line is // provisional_save_manager_ because we just update it on success and so such // forms never end up in an infobar. -class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate, - public NotificationObserver { +class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate { public: SavePasswordInfoBarDelegate(TabContents* tab_contents, PasswordFormManager* form_to_save) : ConfirmInfoBarDelegate(tab_contents), form_to_save_(form_to_save) { - registrar_.Add(this, NOTIFY_TAB_CLOSED, - Source<NavigationController>(tab_contents->controller())); } virtual ~SavePasswordInfoBarDelegate() { } @@ -76,24 +73,12 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate, form_to_save_->PermanentlyBlacklist(); return true; } - - // NotificationObserver - virtual void Observe(NotificationType type, const NotificationSource& source, - const NotificationDetails& details) { - DCHECK(type == NOTIFY_TAB_CLOSED); - // We don't get InfoBarClosed notification when a tab is closed, so we need - // to clean up after ourselves now. - // TODO(timsteele): This should not be necessary; see http://crbug.com/6520 - delete this; - } private: // The PasswordFormManager managing the form we're asking the user about, // and should update as per her decision. scoped_ptr<PasswordFormManager> form_to_save_; - NotificationRegistrar registrar_; - DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate); }; |