summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/gtk
diff options
context:
space:
mode:
authormihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 01:02:12 +0000
committermihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 01:02:12 +0000
commitad938c6ff51be58e39abf0e1261c6eca68d6d0b0 (patch)
tree9711f83e5453e1350525ae57bff039a7464ef6e7 /chrome/browser/ui/gtk
parent20d964aa57babdc35574864d710ac81c77406346 (diff)
downloadchromium_src-ad938c6ff51be58e39abf0e1261c6eca68d6d0b0.zip
chromium_src-ad938c6ff51be58e39abf0e1261c6eca68d6d0b0.tar.gz
chromium_src-ad938c6ff51be58e39abf0e1261c6eca68d6d0b0.tar.bz2
Add support for window size constraints to ShellWindowGtk. (effectively a reland of r124724)
Also switches the GTK and Cocoa ShellWindow implementations from "delete this" to OnNativeClose (follow-on from r141457). R=erg@chromium.org BUG=131343 Review URL: https://chromiumcodereview.appspot.com/10543148 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142052 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/gtk')
-rw-r--r--chrome/browser/ui/gtk/extensions/shell_window_gtk.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
index 19163af..dd8464b 100644
--- a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
+++ b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
@@ -28,6 +28,30 @@ ShellWindowGtk::ShellWindowGtk(Profile* profile,
gtk_window_set_default_size(
window_, params.bounds.width(), params.bounds.height());
+ int min_width = params.minimum_size.width();
+ int min_height = params.minimum_size.height();
+ int max_width = params.maximum_size.width();
+ int max_height = params.maximum_size.height();
+ GdkGeometry hints;
+ int hints_mask = 0;
+ if (min_width || min_height) {
+ hints.min_height = min_height;
+ hints.min_width = min_width;
+ hints_mask |= GDK_HINT_MIN_SIZE;
+ }
+ if (max_width || max_height) {
+ hints.max_height = max_height ? max_height : G_MAXINT;
+ hints.max_width = max_width ? max_width : G_MAXINT;
+ hints_mask |= GDK_HINT_MAX_SIZE;
+ }
+ if (hints_mask) {
+ gtk_window_set_geometry_hints(
+ window_,
+ GTK_WIDGET(window_),
+ &hints,
+ static_cast<GdkWindowHints>(hints_mask));
+ }
+
// TODO(mihaip): Mirror contents of <title> tag in window title
gtk_window_set_title(window_, extension->name().c_str());
@@ -89,7 +113,7 @@ void ShellWindowGtk::Close() {
window_ = NULL;
gtk_widget_destroy(window);
- delete this;
+ OnNativeClose();
}
void ShellWindowGtk::Activate() {