From 058254a8c1f684aecce93ed3d6ba6ca8864611b1 Mon Sep 17 00:00:00 2001 From: "phajdan.jr@chromium.org" Date: Wed, 26 Aug 2009 21:21:43 +0000 Subject: Fix crash in Linux extension shelf. We need to delay creating render view until we're fully constructed. TEST=none BUG=none Review URL: http://codereview.chromium.org/173506 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24530 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/extension_host.cc | 5 +++-- chrome/browser/gtk/extension_view_gtk.cc | 7 ++++++- chrome/browser/gtk/extension_view_gtk.h | 8 +++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 304a399..bc03f8f 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -63,7 +63,8 @@ void ExtensionHost::CreateView(Browser* browser) { // hierarchy. view_->SetParentOwned(false); #elif defined(OS_LINUX) - view_.reset(new ExtensionViewGtk(this)); + view_.reset(new ExtensionViewGtk(this, browser)); + view_->Init(); #else // TODO(port) NOTREACHED(); @@ -298,7 +299,7 @@ void ExtensionHost::HandleMouseLeave() { } Browser* ExtensionHost::GetBrowser() { -#if defined(OS_WIN) +#if defined(OS_WIN) || defined(OS_LINUX) if (view_.get()) return view_->browser(); #endif diff --git a/chrome/browser/gtk/extension_view_gtk.cc b/chrome/browser/gtk/extension_view_gtk.cc index 60d1a3f..e2712cf 100644 --- a/chrome/browser/gtk/extension_view_gtk.cc +++ b/chrome/browser/gtk/extension_view_gtk.cc @@ -8,10 +8,15 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" -ExtensionViewGtk::ExtensionViewGtk(ExtensionHost* extension_host) +ExtensionViewGtk::ExtensionViewGtk(ExtensionHost* extension_host, + Browser* browser) : is_toolstrip_(true), + browser_(browser), extension_host_(extension_host), render_widget_host_view_(NULL) { +} + +void ExtensionViewGtk::Init() { CreateWidgetHostView(); } diff --git a/chrome/browser/gtk/extension_view_gtk.h b/chrome/browser/gtk/extension_view_gtk.h index 1220873..495039d 100644 --- a/chrome/browser/gtk/extension_view_gtk.h +++ b/chrome/browser/gtk/extension_view_gtk.h @@ -8,15 +8,19 @@ #include "base/basictypes.h" #include "base/gfx/native_widget_types.h" +class Browser; class ExtensionHost; class RenderViewHost; class RenderWidgetHostViewGtk; class ExtensionViewGtk { public: - explicit ExtensionViewGtk(ExtensionHost* extension_host); + ExtensionViewGtk(ExtensionHost* extension_host, Browser* browser); + + void Init(); gfx::NativeView native_view(); + Browser* browser() const { return browser_; } bool is_toolstrip() const { return is_toolstrip_; } void set_is_toolstrip(bool is_toolstrip) { is_toolstrip_ = is_toolstrip; } @@ -33,6 +37,8 @@ class ExtensionViewGtk { // True if the contents are being displayed inside the extension shelf. bool is_toolstrip_; + Browser* browser_; + ExtensionHost* extension_host_; RenderWidgetHostViewGtk* render_widget_host_view_; -- cgit v1.1