diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-05 02:12:10 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-05 02:12:10 +0000 |
commit | e3c31d27e49dd4b795fdca9c290fabee1b117b02 (patch) | |
tree | c5b4d960ae0237842d77324542b205e80d4dfcbf /chrome/browser/password_manager_delegate_impl.cc | |
parent | f9486289464b51ffedba0541bf0fbeefc5d53f39 (diff) | |
download | chromium_src-e3c31d27e49dd4b795fdca9c290fabee1b117b02.zip chromium_src-e3c31d27e49dd4b795fdca9c290fabee1b117b02.tar.gz chromium_src-e3c31d27e49dd4b795fdca9c290fabee1b117b02.tar.bz2 |
Replace the virtual InfoBarDelegate::InfoBarClosed() function with a non-virtual one. This is a step along the way to killing it entirely. This also adds a lot of OVERRIDE markers and does some other cleanup in a few places.
The original (stupid) design for the delegate class left subclasses great flexibility in how they mapped infobars to delegates. In practice, no one ever wanted multiple infobars driven off a single delegate, so the mapping was always one-to-one. As a result, it was always correct for InfoBarClosed() to "delete this", but because the base class did not do so, every subclass needed to. Most did; the others leaked memory and failed to run their destructors.
This change forces the base class to delete itself. This fixes the delegate leaks in the couple subclasses that failed to do this. It also eliminates a lot of copy-and-pasted "delete this" implementations.
Ultimately, we'll be moving to a model where the InfoBar "view" class owns the delegate and deletes it directly, which will eliminate InfoBarClosed() completely.
BUG=62154
TEST=none
Review URL: http://codereview.chromium.org/6926001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84195 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/password_manager_delegate_impl.cc')
-rw-r--r-- | chrome/browser/password_manager_delegate_impl.cc | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/chrome/browser/password_manager_delegate_impl.cc b/chrome/browser/password_manager_delegate_impl.cc index 7a5a54d..1a518ba 100644 --- a/chrome/browser/password_manager_delegate_impl.cc +++ b/chrome/browser/password_manager_delegate_impl.cc @@ -41,13 +41,12 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate { virtual ~SavePasswordInfoBarDelegate(); // ConfirmInfoBarDelegate - virtual void InfoBarClosed(); - virtual gfx::Image* GetIcon() const; - virtual Type GetInfoBarType() const; - virtual string16 GetMessageText() const; - virtual string16 GetButtonLabel(InfoBarButton button) const; - virtual bool Accept(); - virtual bool Cancel(); + virtual gfx::Image* GetIcon() const OVERRIDE; + virtual Type GetInfoBarType() const OVERRIDE; + virtual string16 GetMessageText() const OVERRIDE; + virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; + virtual bool Accept() OVERRIDE; + virtual bool Cancel() OVERRIDE; // The PasswordFormManager managing the form we're asking the user about, // and should update as per her decision. @@ -68,12 +67,8 @@ SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate( } SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { -} - -void SavePasswordInfoBarDelegate::InfoBarClosed() { UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", infobar_response_, NUM_RESPONSE_TYPES); - delete this; } gfx::Image* SavePasswordInfoBarDelegate::GetIcon() const { |