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

Unified Diff: chrome/browser/gtk/extension_infobar_gtk.cc

Issue 4767001: Make TabContents own its infobar delegates.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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: 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(

Powered by Google App Engine
This is Rietveld 408576698