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

Unified Diff: trunk/src/chrome/browser/infobars/infobar_delegate.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_delegate.h
===================================================================
--- trunk/src/chrome/browser/infobars/infobar_delegate.h (revision 238401)
+++ trunk/src/chrome/browser/infobars/infobar_delegate.h (working copy)
@@ -51,12 +51,19 @@
// Value to use when the InfoBar has no icon to show.
static const int kNoIconID;
- // Called when the InfoBar that owns this delegate is being destroyed. At
- // this point nothing is visible onscreen.
virtual ~InfoBarDelegate();
virtual InfoBarAutomationType GetInfoBarAutomationType() const;
+ // Called to create the InfoBar. Implementation of this method is
+ // platform-specific.
+ virtual InfoBar* CreateInfoBar(InfoBarService* owner) = 0;
+
+ // TODO(pkasting): Move to InfoBar once InfoBars own their delegates.
+ InfoBarService* owner() { return owner_; }
+
+ void clear_owner() { owner_ = NULL; }
+
// Returns true if the supplied |delegate| is equal to this one. Equality is
// left to the implementation to define. This function is called by the
// InfoBarService when determining whether or not a delegate should be
@@ -97,38 +104,41 @@
virtual ThreeDAPIInfoBarDelegate* AsThreeDAPIInfoBarDelegate();
virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate();
- void set_infobar(InfoBar* infobar) { infobar_ = infobar; }
+ // Return the icon to be shown for this InfoBar. If the returned Image is
+ // empty, no icon is shown.
+ virtual gfx::Image GetIcon() const;
+ content::WebContents* web_contents() {
+ return owner_ ? owner_->web_contents() : NULL;
+ }
+
+ protected:
+ // If |contents| is non-NULL, its active entry's unique ID will be stored
+ // using StoreActiveEntryUniqueID automatically.
+ explicit InfoBarDelegate(InfoBarService* owner);
+
// Store the unique id for the active entry in our WebContents, to be used
// later upon navigation to determine if this InfoBarDelegate should be
// expired.
void StoreActiveEntryUniqueID();
- // Return the icon to be shown for this InfoBar. If the returned Image is
- // empty, no icon is shown.
- virtual gfx::Image GetIcon() const;
+ int contents_unique_id() const { return contents_unique_id_; }
- // This trivial getter is defined out-of-line in order to avoid needing to
- // #include infobar.h, which would lead to circular #includes.
- content::WebContents* web_contents();
-
- protected:
- InfoBarDelegate();
-
// Returns true if the navigation is to a new URL or a reload occured.
virtual bool ShouldExpireInternal(
const content::LoadCommittedDetails& details) const;
- int contents_unique_id() const { return contents_unique_id_; }
- InfoBar* infobar() { return infobar_; }
+ // Removes ourself from |owner_| if we haven't already been removed.
+ // TODO(pkasting): Move to InfoBar.
+ void RemoveSelf();
private:
// The unique id of the active NavigationEntry of the WebContents that we were
// opened for. Used to help expire on navigations.
int contents_unique_id_;
- // The InfoBar associated with us.
- InfoBar* infobar_;
+ // TODO(pkasting): Remove.
+ InfoBarService* owner_;
DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate);
};
« no previous file with comments | « trunk/src/chrome/browser/infobars/infobar_container.cc ('k') | trunk/src/chrome/browser/infobars/infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698