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

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

Issue 4767001: Make TabContents own its infobar delegates.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
Index: chrome/browser/tab_contents/tab_contents.h
===================================================================
--- chrome/browser/tab_contents/tab_contents.h (revision 65711)
+++ chrome/browser/tab_contents/tab_contents.h (working copy)
@@ -457,20 +457,31 @@
// Infobars ------------------------------------------------------------------
- // Adds an InfoBar for the specified |delegate|.
+ // Adds an InfoBar for the specified |delegate|. The TabContents takes
+ // ownership of |delegate| and will close it when it is removed or the tab is
+ // closed. If infobars are disabled for this tab or the tab already has a
+ // delegate which returns true for InfoBarDelegate::EqualsDelegate(delegate),
+ // |delegate| is closed immediately without being added.
virtual void AddInfoBar(InfoBarDelegate* delegate);
- // Removes the InfoBar for the specified |delegate|.
+ // Removes the InfoBar for the specified |delegate|. This will synchronously
+ // trigger delegate->InfoBarClosed() (which generally deletes the delegate).
+ // If infobars are disabled for this tab, this will do nothing, on the
+ // assumption that the matching AddInfoBar() call will have already closed the
+ // delegate (see above).
void RemoveInfoBar(InfoBarDelegate* delegate);
- // Replaces one infobar with another, without any animation in between.
+ // Replaces one infobar with another, without any animation in between. This
+ // will synchronously close |old_delegate|. If infobars are disabled for this
+ // tab, |new_delegate| is closed immediately without being added.
+ // NOTE: This does not perform any EqualsDelegate() checks like AddInfoBar().
void ReplaceInfoBar(InfoBarDelegate* old_delegate,
InfoBarDelegate* new_delegate);
// Enumeration and access functions.
int infobar_delegate_count() const { return infobar_delegates_.size(); }
InfoBarDelegate* GetInfoBarDelegateAt(int index) {
- return infobar_delegates_.at(index);
+ return infobar_delegates_[index];
}
// Toolbars and such ---------------------------------------------------------
@@ -1191,7 +1202,8 @@
// Data for shelves and stuff ------------------------------------------------
// Delegates for InfoBars associated with this TabContents.
- std::vector<InfoBarDelegate*> infobar_delegates_;
+ typedef std::vector<InfoBarDelegate*> InfoBarDelegates;
+ InfoBarDelegates infobar_delegates_;
// Data for find in page -----------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698