Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: chrome/browser/tab_contents/infobar_delegate.h

Issue 6926001: Replace the virtual InfoBarDelegate::InfoBarClosed() function with a non-virtual one. This is a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/plugin_observer.cc ('k') | chrome/browser/tab_contents/infobar_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/infobar_delegate.h
===================================================================
--- chrome/browser/tab_contents/infobar_delegate.h (revision 84141)
+++ chrome/browser/tab_contents/infobar_delegate.h (working copy)
@@ -28,23 +28,6 @@
// does not map to a specific InfoBar type. Instead, you must implement either
// LinkInfoBarDelegate or ConfirmInfoBarDelegate, or override with your own
// delegate for your own InfoBar variety.
-//
-// --- WARNING ---
-// When creating your InfoBarDelegate subclass, it is recommended that you
-// design it such that you instantiate a brand new delegate for every call to
-// AddInfoBar, rather than re-using/sharing a delegate object. Otherwise,
-// you need to consider the fact that more than one InfoBar instance can exist
-// and reference the same delegate -- even though it is also true that we only
-// ever fully show one infobar (they don't stack). The dual-references occur
-// because a second InfoBar can be added while the first one is in the process
-// of closing (the animations). This can cause problems because when the first
-// one does finally fully close InfoBarDelegate::InfoBarClosed() is called,
-// and the delegate is free to clean itself up or reset state, which may have
-// fatal consequences for the InfoBar that was in the process of opening (or is
-// now fully opened) -- it is referencing a delegate that may not even exist
-// anymore.
-// As such, it is generally much safer to dedicate a delegate instance to
-// AddInfoBar!
class InfoBarDelegate {
public:
// The type of the infobar. It controls its appearance, such as its background
@@ -77,9 +60,9 @@
// Called when the user clicks on the close button to dismiss the infobar.
virtual void InfoBarDismissed();
- // Called after the InfoBar is closed. The delegate is free to delete itself
- // at this point.
- virtual void InfoBarClosed();
+ // Called after the InfoBar is closed. Deletes |this|.
+ // TODO(pkasting): Get rid of this and delete delegates directly.
+ void InfoBarClosed();
// Return the icon to be shown for this InfoBar. If the returned Image is
// NULL, no icon is shown.
« no previous file with comments | « chrome/browser/plugin_observer.cc ('k') | chrome/browser/tab_contents/infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698