diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 21:34:11 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 21:34:11 +0000 |
commit | 1f74cfc185bb4d47532994a206a901bc708d3ff6 (patch) | |
tree | 93d7602cc3b4420c66d08fc5ece46618bff24dc7 | |
parent | f0a5d7cd1a65d7ff71299f95ee78929729694f25 (diff) | |
download | chromium_src-1f74cfc185bb4d47532994a206a901bc708d3ff6.zip chromium_src-1f74cfc185bb4d47532994a206a901bc708d3ff6.tar.gz chromium_src-1f74cfc185bb4d47532994a206a901bc708d3ff6.tar.bz2 |
Correctly handle extensions width in the GTK extension shelf.
Also make the method name used on Windows shorter and more obvious.
TEST=none
http://crbug.com/16759
Review URL: http://codereview.chromium.org/164092
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22672 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/extension_host.cc | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/extension_shelf_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/extension_view_gtk.cc | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/extension_view_gtk.h | 4 | ||||
-rw-r--r-- | chrome/browser/views/extensions/extension_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/extensions/extension_view.h | 2 |
6 files changed, 14 insertions, 6 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 17062ce..ee81c39 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -178,9 +178,9 @@ void ExtensionHost::RecoverCrashedExtension() { } void ExtensionHost::UpdatePreferredWidth(int pref_width) { -#if defined(OS_WIN) +#if defined(TOOLKIT_VIEWS) || defined(OS_LINUX) if (view_.get()) - view_->DidContentsPreferredWidthChange(pref_width); + view_->UpdatePreferredWidth(pref_width); #endif } diff --git a/chrome/browser/gtk/extension_shelf_gtk.cc b/chrome/browser/gtk/extension_shelf_gtk.cc index 1262c16..768aee8 100644 --- a/chrome/browser/gtk/extension_shelf_gtk.cc +++ b/chrome/browser/gtk/extension_shelf_gtk.cc @@ -47,7 +47,7 @@ class ExtensionShelfGtk::Toolstrip { }; void ExtensionShelfGtk::Toolstrip::AddToolstripToBox(GtkWidget* box) { - gtk_box_pack_start(GTK_BOX(box), native_view(), TRUE, TRUE, + gtk_box_pack_start(GTK_BOX(box), native_view(), FALSE, FALSE, kToolstripPadding); } diff --git a/chrome/browser/gtk/extension_view_gtk.cc b/chrome/browser/gtk/extension_view_gtk.cc index 5940d0f..60d1a3f 100644 --- a/chrome/browser/gtk/extension_view_gtk.cc +++ b/chrome/browser/gtk/extension_view_gtk.cc @@ -23,6 +23,10 @@ RenderViewHost* ExtensionViewGtk::render_view_host() const { return extension_host_->render_view_host(); } +void ExtensionViewGtk::UpdatePreferredWidth(int pref_width) { + gtk_widget_set_size_request(native_view(), pref_width, -1); +} + void ExtensionViewGtk::CreateWidgetHostView() { DCHECK(!render_widget_host_view_); render_widget_host_view_ = new RenderWidgetHostViewGtk(render_view_host()); diff --git a/chrome/browser/gtk/extension_view_gtk.h b/chrome/browser/gtk/extension_view_gtk.h index b569c03..1220873 100644 --- a/chrome/browser/gtk/extension_view_gtk.h +++ b/chrome/browser/gtk/extension_view_gtk.h @@ -21,6 +21,10 @@ class ExtensionViewGtk { bool is_toolstrip() const { return is_toolstrip_; } void set_is_toolstrip(bool is_toolstrip) { is_toolstrip_ = is_toolstrip; } + // Method for the ExtensionHost to notify us about the correct width for + // extension contents. + void UpdatePreferredWidth(int pref_width); + private: RenderViewHost* render_view_host() const; diff --git a/chrome/browser/views/extensions/extension_view.cc b/chrome/browser/views/extensions/extension_view.cc index 1518567..63f37db 100644 --- a/chrome/browser/views/extensions/extension_view.cc +++ b/chrome/browser/views/extensions/extension_view.cc @@ -103,7 +103,7 @@ void ExtensionView::ShowIfCompletelyLoaded() { !is_clipped_ && did_insert_css_ && !render_view_host()->view()->background().empty()) { SetVisible(true); - DidContentsPreferredWidthChange(pending_preferred_width_); + UpdatePreferredWidth(pending_preferred_width_); } } @@ -124,7 +124,7 @@ void ExtensionView::SetBackground(const SkBitmap& background) { ShowIfCompletelyLoaded(); } -void ExtensionView::DidContentsPreferredWidthChange(const int pref_width) { +void ExtensionView::UpdatePreferredWidth(int pref_width) { // Don't actually do anything with this information until we have been shown. // Size changes will not be honored by lower layers while we are hidden. gfx::Size preferred_size = GetPreferredSize(); diff --git a/chrome/browser/views/extensions/extension_view.h b/chrome/browser/views/extensions/extension_view.h index df3ca2d..75f7a3f 100644 --- a/chrome/browser/views/extensions/extension_view.h +++ b/chrome/browser/views/extensions/extension_view.h @@ -42,7 +42,7 @@ class ExtensionView : public views::NativeViewHost { void set_is_toolstrip(bool is) { is_toolstrip_ = is; } // Notification from ExtensionHost. - void DidContentsPreferredWidthChange(const int pref_width); + void UpdatePreferredWidth(int pref_width); void HandleMouseEvent(); void HandleMouseLeave(); |