#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/infobars/confirm_infobar_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
class Browser;
class GURL;
namespace extensions {
class Extension;
class ExtensionViewHost;
}
class ExtensionInfoBarDelegate : public InfoBarDelegate,
public content::NotificationObserver {
public:
virtual ~ExtensionInfoBarDelegate();
static void Create(content::WebContents* web_contents,
Browser* browser,
const extensions::Extension* extension,
const GURL& url,
int height);
const extensions::Extension* extension() { return extension_; }
extensions::ExtensionViewHost* extension_view_host() {
return extension_view_host_.get();
}
int height() { return height_; }
bool closing() const { return closing_; }
private:
ExtensionInfoBarDelegate(Browser* browser,
const extensions::Extension* extension,
const GURL& url,
content::WebContents* web_contents,
int height);
static scoped_ptr<InfoBar> CreateInfoBar(
scoped_ptr<ExtensionInfoBarDelegate> delegate);
virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE;
virtual void InfoBarDismissed() OVERRIDE;
virtual Type GetInfoBarType() const OVERRIDE;
virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() OVERRIDE;
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
#if defined(TOOLKIT_VIEWS)
Browser* browser_;
#endif
scoped_ptr<extensions::ExtensionViewHost> extension_view_host_;
const extensions::Extension* extension_;
content::NotificationRegistrar registrar_;
int height_;
bool closing_;
DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate);
};
#endif