diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 03:16:26 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 03:16:26 +0000 |
commit | 42b0ecedf7eb4beea125ac17ffc0cd373f4b420c (patch) | |
tree | 8c2026442208c18ec14613f0f6132b24acd1e7de /chrome/browser/infobars/simple_alert_infobar_delegate.cc | |
parent | 37a241c6f22e761a07d9ff70aff1b15674eb8bf6 (diff) | |
download | chromium_src-42b0ecedf7eb4beea125ac17ffc0cd373f4b420c.zip chromium_src-42b0ecedf7eb4beea125ac17ffc0cd373f4b420c.tar.gz chromium_src-42b0ecedf7eb4beea125ac17ffc0cd373f4b420c.tar.bz2 |
Infobar system refactor.
This changes the ownership model of infobars so that InfoBars are long-lived and
own their InfoBarDelegates directly. The InfoBarService pseudo-owns the
InfoBars (instead of deleting them directly, it tells them when they're unowned
and expects them to delete themselves).
This fixes leaks when infobars are closed while not visible (e.g. in a
background tab) and in general makes the system clearer and easier to reason
about.
BUG=62154
TEST=none
R=erg@chromium.org, sail@chromium.org, sky@chromium.org
Review URL: https://codereview.chromium.org/22694006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238283 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/infobars/simple_alert_infobar_delegate.cc')
-rw-r--r-- | chrome/browser/infobars/simple_alert_infobar_delegate.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/chrome/browser/infobars/simple_alert_infobar_delegate.cc b/chrome/browser/infobars/simple_alert_infobar_delegate.cc index 6e8b82c..0c092f2 100644 --- a/chrome/browser/infobars/simple_alert_infobar_delegate.cc +++ b/chrome/browser/infobars/simple_alert_infobar_delegate.cc @@ -4,6 +4,7 @@ #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" +#include "chrome/browser/infobars/infobar.h" #include "chrome/browser/infobars/infobar_service.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -12,17 +13,16 @@ void SimpleAlertInfoBarDelegate::Create(InfoBarService* infobar_service, int icon_id, const string16& message, bool auto_expire) { - infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( - new SimpleAlertInfoBarDelegate(infobar_service, icon_id, message, - auto_expire))); + infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + scoped_ptr<ConfirmInfoBarDelegate>( + new SimpleAlertInfoBarDelegate(icon_id, message, auto_expire)))); } SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate( - InfoBarService* infobar_service, int icon_id, const string16& message, bool auto_expire) - : ConfirmInfoBarDelegate(infobar_service), + : ConfirmInfoBarDelegate(), icon_id_(icon_id), message_(message), auto_expire_(auto_expire) { |