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

Unified Diff: trunk/src/chrome/browser/extensions/extension_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/extensions/extension_infobar_delegate.h
===================================================================
--- trunk/src/chrome/browser/extensions/extension_infobar_delegate.h (revision 238401)
+++ trunk/src/chrome/browser/extensions/extension_infobar_delegate.h (working copy)
@@ -24,10 +24,18 @@
class ExtensionInfoBarDelegate : public InfoBarDelegate,
public content::NotificationObserver {
public:
+ // The observer for when the delegate dies.
+ class DelegateObserver {
+ public:
+ virtual void OnDelegateDeleted() = 0;
+
+ protected:
+ virtual ~DelegateObserver() {}
+ };
+
virtual ~ExtensionInfoBarDelegate();
- // Creates an extension infobar and delegate and adds the infobar to
- // |infobar_service|.
+ // Creates an extension infobar delegate and adds it to |infobar_service|.
static void Create(InfoBarService* infobar_service,
Browser* browser,
const extensions::Extension* extension,
@@ -40,20 +48,20 @@
}
int height() { return height_; }
+ void set_observer(DelegateObserver* observer) { observer_ = observer; }
+
bool closing() const { return closing_; }
private:
ExtensionInfoBarDelegate(Browser* browser,
+ InfoBarService* infobar_service,
const extensions::Extension* extension,
const GURL& url,
content::WebContents* web_contents,
int height);
- // Returns an extension infobar that owns |delegate|.
- static scoped_ptr<InfoBar> CreateInfoBar(
- scoped_ptr<ExtensionInfoBarDelegate> delegate);
-
// InfoBarDelegate:
+ virtual InfoBar* CreateInfoBar(InfoBarService* owner) OVERRIDE;
virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE;
virtual void InfoBarDismissed() OVERRIDE;
virtual Type GetInfoBarType() const OVERRIDE;
@@ -68,10 +76,15 @@
Browser* browser_; // We pass this to the ExtensionInfoBar.
#endif
- // The extension host we are showing the InfoBar for.
- // TODO(pkasting): Should this live on the InfoBar instead?
+ // The extension host we are showing the InfoBar for. The delegate needs to
+ // own this since the InfoBar gets deleted and recreated when you switch tabs
+ // and come back (and we don't want the user's interaction with the InfoBar to
+ // get lost at that point).
scoped_ptr<extensions::ExtensionViewHost> extension_view_host_;
+ // The observer monitoring when the delegate dies.
+ DelegateObserver* observer_;
+
const extensions::Extension* extension_;
content::NotificationRegistrar registrar_;

Powered by Google App Engine
This is Rietveld 408576698