| Index: chrome/browser/ui/views/infobars/extension_infobar.cc
|
| ===================================================================
|
| --- chrome/browser/ui/views/infobars/extension_infobar.cc (revision 238220)
|
| +++ chrome/browser/ui/views/infobars/extension_infobar.cc (working copy)
|
| @@ -29,8 +29,11 @@
|
|
|
| // ExtensionInfoBarDelegate ----------------------------------------------------
|
|
|
| -InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) {
|
| - return new ExtensionInfoBar(owner, this, browser_);
|
| +// static
|
| +scoped_ptr<InfoBar> ExtensionInfoBarDelegate::CreateInfoBar(
|
| + scoped_ptr<ExtensionInfoBarDelegate> delegate) {
|
| + Browser* browser = delegate->browser_;
|
| + return scoped_ptr<InfoBar>(new ExtensionInfoBar(delegate.Pass(), browser));
|
| }
|
|
|
|
|
| @@ -78,25 +81,20 @@
|
|
|
| } // namespace
|
|
|
| -ExtensionInfoBar::ExtensionInfoBar(InfoBarService* owner,
|
| - ExtensionInfoBarDelegate* delegate,
|
| - Browser* browser)
|
| - : InfoBarView(owner, delegate),
|
| - delegate_(delegate),
|
| +ExtensionInfoBar::ExtensionInfoBar(
|
| + scoped_ptr<ExtensionInfoBarDelegate> delegate,
|
| + Browser* browser)
|
| + : InfoBarView(delegate.PassAs<InfoBarDelegate>()),
|
| 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() {
|
| @@ -166,10 +164,6 @@
|
|
|
| }
|
|
|
| -void ExtensionInfoBar::OnDelegateDeleted() {
|
| - delegate_ = NULL;
|
| -}
|
| -
|
| void ExtensionInfoBar::OnMenuButtonClicked(views::View* source,
|
| const gfx::Point& point) {
|
| if (!owner())
|
| @@ -215,5 +209,5 @@
|
| }
|
|
|
| ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
|
| - return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL;
|
| + return delegate()->AsExtensionInfoBarDelegate();
|
| }
|
|
|