diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-25 01:06:05 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-25 01:06:05 +0000 |
commit | f86a07024080cd1b000105bce34ce45b2bd5159b (patch) | |
tree | d47e27fae62581ffb7f4e4209c7dd0106b88763f /chrome/browser/infobar_delegate.h | |
parent | 2d42a37132679537eb9e8db9f45a6dfe92dde996 (diff) | |
download | chromium_src-f86a07024080cd1b000105bce34ce45b2bd5159b.zip chromium_src-f86a07024080cd1b000105bce34ce45b2bd5159b.tar.gz chromium_src-f86a07024080cd1b000105bce34ce45b2bd5159b.tar.bz2 |
Re-land 5929 (r5882) with crash fix and also this change:
http://codereview.chromium.org/11392/show
which fixes the remainder of the UI test issues apparently.
http://crbug.com/4620
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/infobar_delegate.h')
-rw-r--r-- | chrome/browser/infobar_delegate.h | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/chrome/browser/infobar_delegate.h b/chrome/browser/infobar_delegate.h index 47f2532..33b750a 100644 --- a/chrome/browser/infobar_delegate.h +++ b/chrome/browser/infobar_delegate.h @@ -8,6 +8,7 @@ #include <string> #include "base/basictypes.h" +#include "chrome/browser/navigation_controller.h" #include "skia/include/SkBitmap.h" class AlertInfoBarDelegate; @@ -32,8 +33,10 @@ class InfoBarDelegate { } // Returns true if the InfoBar should be closed automatically after the page - // is navigated. - virtual bool ShouldCloseOnNavigate() const { return true; } + // is navigated. The default behavior is to return true if the page is + // navigated somewhere else or reloaded. + virtual bool ShouldExpire( + const NavigationController::LoadCommittedDetails& details) const; // Called after the InfoBar is closed. The delegate is free to delete itself // at this point. @@ -52,6 +55,21 @@ class InfoBarDelegate { virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() { return NULL; } + + protected: + // Constructs the InfoBarDelegate for the specified TabContents' + // NavigationController. + explicit InfoBarDelegate(TabContents* contents); + + private: + // The TabContents this InfoBarDelegate was added to. + TabContents* contents_; + + // The unique id of the active NavigationEntry of the TabContents taht we were + // opened for. Used to help expire on navigations. + int contents_unique_id_; + + DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); }; // An interface derived from InfoBarDelegate implemented by objects wishing to @@ -69,6 +87,11 @@ class AlertInfoBarDelegate : public InfoBarDelegate { virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; virtual InfoBar* CreateInfoBar(); virtual AlertInfoBarDelegate* AsAlertInfoBarDelegate() { return this; } + + protected: + explicit AlertInfoBarDelegate(TabContents* contents); + + DISALLOW_COPY_AND_ASSIGN(AlertInfoBarDelegate); }; // An interface derived from InfoBarDelegate implemented by objects wishing to @@ -101,13 +124,20 @@ class ConfirmInfoBarDelegate : public AlertInfoBarDelegate { virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() { return this; } + + protected: + explicit ConfirmInfoBarDelegate(TabContents* contents); + + DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); }; // Simple implementations for common use cases --------------------------------- class SimpleAlertInfoBarDelegate : public AlertInfoBarDelegate { public: - SimpleAlertInfoBarDelegate(const std::wstring& message, SkBitmap* icon); + SimpleAlertInfoBarDelegate(TabContents* contents, + const std::wstring& message, + SkBitmap* icon); // Overridden from AlertInfoBarDelegate: virtual std::wstring GetMessageText() const; |