summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 02:39:33 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 02:39:33 +0000
commit3e7801ea1a23c5dfa5e5dc5fdac0943a2e814467 (patch)
tree1d7911bd8dc6345ed4fbf8cc33fa9ea1d32d3ede /chrome/browser
parent99efb7b19b5ecb8e7f8f3b646f191fda8a756841 (diff)
downloadchromium_src-3e7801ea1a23c5dfa5e5dc5fdac0943a2e814467.zip
chromium_src-3e7801ea1a23c5dfa5e5dc5fdac0943a2e814467.tar.gz
chromium_src-3e7801ea1a23c5dfa5e5dc5fdac0943a2e814467.tar.bz2
Limit the size of extension views on linux.
BUG=26162 TEST=<img height="100%"> Review URL: http://codereview.chromium.org/505047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34924 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gtk/extension_view_gtk.cc23
-rw-r--r--chrome/browser/gtk/extension_view_gtk.h6
2 files changed, 17 insertions, 12 deletions
diff --git a/chrome/browser/gtk/extension_view_gtk.cc b/chrome/browser/gtk/extension_view_gtk.cc
index 691ce54..cfe0970 100644
--- a/chrome/browser/gtk/extension_view_gtk.cc
+++ b/chrome/browser/gtk/extension_view_gtk.cc
@@ -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;
+
+} // namespace
+
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::SetBackground(const SkBitmap& background) {
}
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() {
diff --git a/chrome/browser/gtk/extension_view_gtk.h b/chrome/browser/gtk/extension_view_gtk.h
index 2bb2923..91d1ded 100644
--- a/chrome/browser/gtk/extension_view_gtk.h
+++ b/chrome/browser/gtk/extension_view_gtk.h
@@ -25,9 +25,6 @@ class ExtensionViewGtk {
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 @@ class ExtensionViewGtk {
private:
void CreateWidgetHostView();
- // True if the contents are being displayed inside the extension shelf.
- bool is_toolstrip_;
-
Browser* browser_;
ExtensionHost* extension_host_;