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

Unified Diff: trunk/src/chrome/browser/infobars/infobar_container.h

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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: trunk/src/chrome/browser/infobars/infobar_container.h
===================================================================
--- trunk/src/chrome/browser/infobars/infobar_container.h (revision 238401)
+++ trunk/src/chrome/browser/infobars/infobar_container.h (working copy)
@@ -14,10 +14,11 @@
#include "third_party/skia/include/core/SkColor.h"
class InfoBar;
+class InfoBarDelegate;
class InfoBarService;
// InfoBarContainer is a cross-platform base class to handle the visibility-
-// related aspects of InfoBars. While InfoBarService owns the InfoBars, the
+// related aspects of InfoBars. While InfoBars own themselves, the
// InfoBarContainer is responsible for telling particular InfoBars that they
// should be hidden or visible.
//
@@ -46,9 +47,8 @@
virtual ~InfoBarContainer();
// Changes the InfoBarService for which this container is showing infobars.
- // This will hide all current infobars, remove them from the container, add
- // the infobars from |infobar_service|, and show them all. |infobar_service|
- // may be NULL.
+ // This will remove all current infobars from the container, add the infobars
+ // from |infobar_service|, and show them all. |infobar_service| may be NULL.
void ChangeInfoBarService(InfoBarService* infobar_service);
// Returns the amount by which to overlap the toolbar above, and, when
@@ -73,7 +73,8 @@
void OnInfoBarStateChanged(bool is_animating);
// Called by |infobar| to request that it be removed from the container. At
- // this point, |infobar| should already be hidden.
+ // this point, |infobar| should already be hidden. Once the infobar is
+ // removed, it is guaranteed to delete itself and will not be re-added again.
void RemoveInfoBar(InfoBar* infobar);
const Delegate* delegate() const { return delegate_; }
@@ -106,6 +107,17 @@
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // Hides an InfoBar for the specified delegate, in response to a notification
+ // from the selected InfoBarService. The InfoBar's disappearance will be
+ // animated if |use_animation| is true. The InfoBar will call back to
+ // RemoveInfoBar() to remove itself once it's hidden (which may mean
+ // synchronously). Returns the position within |infobars_| the infobar was
+ // previously at.
+ size_t HideInfoBar(InfoBar* infobar, bool use_animation);
+
+ // Find an existing infobar in the container.
+ InfoBar* FindInfoBar(InfoBarDelegate* delegate);
+
// Hides all infobars in this container without animation.
void HideAllInfoBars();
@@ -114,6 +126,10 @@
// infobar->Show(). Depending on the value of |callback_status|, this calls
// infobar->set_container(this) either before or after the call to Show() so
// that OnInfoBarStateChanged() either will or won't be called as a result.
+ //
+ // This should be called only once for an infobar -- once it's added, it can
+ // be repeatedly shown and hidden, but not removed and then re-added (see
+ // comments on RemoveInfoBar()).
enum CallbackStatus { NO_CALLBACK, WANT_CALLBACK };
void AddInfoBar(InfoBar* infobar,
size_t position,
« no previous file with comments | « trunk/src/chrome/browser/infobars/infobar.cc ('k') | trunk/src/chrome/browser/infobars/infobar_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698