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

Unified Diff: chrome/browser/ui/gtk/extensions/shell_window_gtk.cc

Issue 9570059: Add support for window size constraints to ShellWindowGtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
index fa59701f5664dc70d231f723cd45789f9501703d..bff76e0d6a07828a3f349d9f48bff51288f06921 100644
--- a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
+++ b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
@@ -15,12 +15,38 @@ ShellWindowGtk::ShellWindowGtk(ExtensionHost* host)
gtk_container_add(GTK_CONTAINER(window_), host_->view()->native_view());
- // TOOD(mihaip): Allow window dimensions to be specified in manifest (and
- // restore prior window dimensions and positions on relaunch).
- gtk_widget_set_size_request(GTK_WIDGET(window_), 512, 384);
+ const Extension* extension = host_->extension();
+
+ // TOOD(mihaip): restore prior window dimensions and positions on relaunch.
+ gtk_window_set_default_size(
+ window_, extension->launch_width(), extension->launch_height());
+
+ int min_width = extension->launch_min_width();
+ int min_height = extension->launch_min_height();
+ int max_width = extension->launch_max_width();
+ int max_height = extension->launch_max_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;
Mihai Parparita -not on Chrome 2012/03/02 02:01:00 Per http://developer.gnome.org/gdk/stable/gdk-Wind
+ 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_, host->extension()->name().c_str());
+ gtk_window_set_title(window_, extension->name().c_str());
g_signal_connect(window_, "delete-event",
G_CALLBACK(OnMainWindowDeleteEventThunk), this);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698