Index: chrome/browser/gtk/extension_infobar_gtk.cc |
=================================================================== |
--- chrome/browser/gtk/extension_infobar_gtk.cc (revision 65711) |
+++ chrome/browser/gtk/extension_infobar_gtk.cc (working copy) |
@@ -17,22 +17,17 @@ |
ExtensionInfoBarGtk::ExtensionInfoBarGtk(ExtensionInfoBarDelegate* delegate) |
: InfoBar(delegate), |
tracker_(this), |
- delegate_(delegate), |
view_(NULL) { |
- delegate_->extension_host()->view()->SetContainer(this); |
+ delegate->extension_host()->view()->SetContainer(this); |
BuildWidgets(); |
} |
ExtensionInfoBarGtk::~ExtensionInfoBarGtk() { |
- // This view is not owned by us, so unparent. |
- gtk_widget_unparent(view_->native_view()); |
} |
-void ExtensionInfoBarGtk::OnImageLoaded( |
- SkBitmap* image, ExtensionResource resource, int index) { |
- if (!delegate_) |
- return; // The delegate can go away while we asynchronously load images. |
- |
+void ExtensionInfoBarGtk::OnImageLoaded(SkBitmap* image, |
+ ExtensionResource resource, |
+ int index) { |
ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
SkBitmap* icon; |
@@ -47,7 +42,8 @@ |
void ExtensionInfoBarGtk::BuildWidgets() { |
// Start loading the image for the menu button. |
- const Extension* extension = delegate_->extension_host()->extension(); |
+ ExtensionHost* extension_host = GetDelegate()->extension_host(); |
+ const Extension* extension = extension_host->extension(); |
ExtensionResource icon_resource = extension->GetIconResource( |
Extension::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_EXACTLY); |
if (!icon_resource.relative_path().empty()) { |
@@ -60,7 +56,6 @@ |
OnImageLoaded(NULL, icon_resource, 0); // |image|, |index|. |
} |
- ExtensionHost* extension_host = delegate_->extension_host(); |
view_ = extension_host->view(); |
gtk_box_pack_start(GTK_BOX(hbox_), view_->native_view(), TRUE, TRUE, 0); |
@@ -70,10 +65,10 @@ |
void ExtensionInfoBarGtk::OnSizeAllocate(GtkWidget* widget, |
GtkAllocation* allocation) { |
- gfx::Size new_size(allocation->width, allocation->height); |
- |
- delegate_->extension_host()->view()->render_view_host()->view() |
- ->SetSize(new_size); |
+ if (delegate()) { |
+ GetDelegate()->extension_host()->view()->render_view_host()->view()-> |
+ SetSize(gfx::Size(allocation->width, allocation->height)); |
+ } |
} |
void ExtensionInfoBarGtk::OnExtensionPreferredSizeChanged( |