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/translate/translate_infobar_delegate.h | |
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/translate/translate_infobar_delegate.h')
-rw-r--r-- | chrome/browser/translate/translate_infobar_delegate.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/chrome/browser/translate/translate_infobar_delegate.h b/chrome/browser/translate/translate_infobar_delegate.h index 9d763089..03c196e 100644 --- a/chrome/browser/translate/translate_infobar_delegate.h +++ b/chrome/browser/translate/translate_infobar_delegate.h @@ -159,12 +159,11 @@ class TranslateInfoBarDelegate : public InfoBarDelegate { typedef std::pair<std::string, string16> LanguageNamePair; // InfoBarDelegate: - virtual InfoBar* CreateInfoBar(); - virtual void InfoBarDismissed(); - virtual void InfoBarClosed(); - virtual gfx::Image* GetIcon() const; - virtual InfoBarDelegate::Type GetInfoBarType() const; - virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate(); + virtual InfoBar* CreateInfoBar() OVERRIDE; + virtual void InfoBarDismissed() OVERRIDE; + virtual gfx::Image* GetIcon() const OVERRIDE; + virtual InfoBarDelegate::Type GetInfoBarType() const OVERRIDE; + virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() OVERRIDE; // Gets the host of the page being translated, or an empty string if no URL is // associated with the current page. |