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

Issue 505047: Limit the size of extension views on linux.... (Closed)

Created:
11 years ago by Evan Stade
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com, Aaron Boodman, Erik does not do reviews, pam+watch_chromium.org, ben+cc_chromium.org
Visibility:
Public.

Description

Limit the size of extension views on linux. BUG=26162 TEST=<img height="100%"> Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=34924

Patch Set 1 #

Patch Set 2 : // namespace #

Unified diffs Side-by-side diffs Delta from patch set Stats (+17 lines, -12 lines) Patch
M chrome/browser/gtk/extension_view_gtk.h View 2 chunks +0 lines, -6 lines 0 comments Download
M chrome/browser/gtk/extension_view_gtk.cc View 1 2 chunks +17 lines, -6 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
Evan Stade
11 years ago (2009-12-18 01:12:50 UTC) #1
Elliot Glaysher
11 years ago (2009-12-18 01:45:02 UTC) #2
LGTM

On Thu, Dec 17, 2009 at 5:12 PM,  <estade@chromium.org> wrote:
> Reviewers: Aaron Boodman, Elliot Glaysher,
>
> Description:
> Limit the size of extension views on linux.
>
> BUG=26162
> TEST=<img height="100%">
>
>
> Please review this at http://codereview.chromium.org/505047
>
> SVN Base: svn://chrome-svn/chrome/trunk/src/
>
> Affected files:
>  M     chrome/browser/gtk/extension_view_gtk.h
>  M     chrome/browser/gtk/extension_view_gtk.cc
>
>
> Index: chrome/browser/gtk/extension_view_gtk.cc
> ===================================================================
> --- chrome/browser/gtk/extension_view_gtk.cc    (revision 34902)
> +++ chrome/browser/gtk/extension_view_gtk.cc    (working copy)
> @@ -8,10 +8,21 @@
>  #include "chrome/browser/renderer_host/render_view_host.h"
>  #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
>
> +namespace {
> +
> +// The minimum/maximum dimensions of the extension view.
> +// The minimum is just a little larger than the size of a browser action
> button.
> +// The maximum is an arbitrary number that should be smaller than most
> screens.
> +const int kMinWidth = 25;
> +const int kMinHeight = 25;
> +const int kMaxWidth = 800;
> +const int kMaxHeight = 600;
> +
> +}
> +
>  ExtensionViewGtk::ExtensionViewGtk(ExtensionHost* extension_host,
>                                    Browser* browser)
> -    : is_toolstrip_(false),
> -      browser_(browser),
> +    : browser_(browser),
>       extension_host_(extension_host),
>       render_widget_host_view_(NULL) {
>  }
> @@ -37,11 +48,11 @@
>  }
>
>  void ExtensionViewGtk::UpdatePreferredSize(const gfx::Size& new_size) {
> -  // If we are showing in a shelf, then the shelf sets our height.
> -  int height = is_toolstrip() ? -1 : new_size.height();
> +  int width = std::max(kMinWidth, std::min(kMaxWidth, new_size.width()));
> +  int height = std::max(kMinHeight, std::min(kMaxHeight,
> new_size.height()));
>
> -  render_widget_host_view_->SetSize(gfx::Size(new_size.width(), height));
> -  gtk_widget_set_size_request(native_view(), new_size.width(), height);
> +  render_widget_host_view_->SetSize(gfx::Size(width, height));
> +  gtk_widget_set_size_request(native_view(), width, height);
>  }
>
>  void ExtensionViewGtk::CreateWidgetHostView() {
> Index: chrome/browser/gtk/extension_view_gtk.h
> ===================================================================
> --- chrome/browser/gtk/extension_view_gtk.h     (revision 34902)
> +++ chrome/browser/gtk/extension_view_gtk.h     (working copy)
> @@ -25,9 +25,6 @@
>   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;
> }
> -
>   void SetBackground(const SkBitmap& background);
>
>   // Method for the ExtensionHost to notify us about the correct size for
> @@ -43,9 +40,6 @@
>  private:
>   void CreateWidgetHostView();
>
> -  // True if the contents are being displayed inside the extension shelf.
> -  bool is_toolstrip_;
> -
>   Browser* browser_;
>
>   ExtensionHost* extension_host_;
>
>
>

Powered by Google App Engine
This is Rietveld 408576698