| Index: trunk/src/chrome/browser/ui/views/infobars/extension_infobar.cc
|
| ===================================================================
|
| --- trunk/src/chrome/browser/ui/views/infobars/extension_infobar.cc (revision 238401)
|
| +++ trunk/src/chrome/browser/ui/views/infobars/extension_infobar.cc (working copy)
|
| @@ -29,11 +29,8 @@
|
|
|
| // ExtensionInfoBarDelegate ----------------------------------------------------
|
|
|
| -// static
|
| -scoped_ptr<InfoBar> ExtensionInfoBarDelegate::CreateInfoBar(
|
| - scoped_ptr<ExtensionInfoBarDelegate> delegate) {
|
| - Browser* browser = delegate->browser_;
|
| - return scoped_ptr<InfoBar>(new ExtensionInfoBar(delegate.Pass(), browser));
|
| +InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) {
|
| + return new ExtensionInfoBar(owner, this, browser_);
|
| }
|
|
|
|
|
| @@ -81,20 +78,25 @@
|
|
|
| } // namespace
|
|
|
| -ExtensionInfoBar::ExtensionInfoBar(
|
| - scoped_ptr<ExtensionInfoBarDelegate> delegate,
|
| - Browser* browser)
|
| - : InfoBarView(delegate.PassAs<InfoBarDelegate>()),
|
| +ExtensionInfoBar::ExtensionInfoBar(InfoBarService* owner,
|
| + ExtensionInfoBarDelegate* delegate,
|
| + Browser* browser)
|
| + : InfoBarView(owner, delegate),
|
| + delegate_(delegate),
|
| browser_(browser),
|
| infobar_icon_(NULL),
|
| icon_as_menu_(NULL),
|
| icon_as_image_(NULL),
|
| weak_ptr_factory_(this) {
|
| + GetDelegate()->set_observer(this);
|
| +
|
| int height = GetDelegate()->height();
|
| SetBarTargetHeight((height > 0) ? (height + kSeparatorLineHeight) : 0);
|
| }
|
|
|
| ExtensionInfoBar::~ExtensionInfoBar() {
|
| + if (GetDelegate())
|
| + GetDelegate()->set_observer(NULL);
|
| }
|
|
|
| void ExtensionInfoBar::Layout() {
|
| @@ -164,6 +166,10 @@
|
|
|
| }
|
|
|
| +void ExtensionInfoBar::OnDelegateDeleted() {
|
| + delegate_ = NULL;
|
| +}
|
| +
|
| void ExtensionInfoBar::OnMenuButtonClicked(views::View* source,
|
| const gfx::Point& point) {
|
| if (!owner())
|
| @@ -209,5 +215,5 @@
|
| }
|
|
|
| ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
|
| - return delegate()->AsExtensionInfoBarDelegate();
|
| + return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL;
|
| }
|
|
|