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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 7003063: Enforce different min size for popups than tabbed browsers on MacOSX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address prev round of feedback Created 9 years, 6 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
Index: chrome/browser/ui/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 873b1f5967a0a807b7656818e0c007c137a7b779..72ff66738d397ff091bcbccc4a9a93d669fb33dd 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -274,13 +274,9 @@ enum {
// Note that this may leave a significant portion of the window
// offscreen, but there will always be enough window onscreen to
// drag the whole window back into view.
- NSSize minSize = [[self window] minSize];
gfx::Rect desiredContentRect = browser_->GetSavedWindowBounds();
gfx::Rect windowRect = desiredContentRect;
- if (windowRect.width() < minSize.width)
- windowRect.set_width(minSize.width);
- if (windowRect.height() < minSize.height)
- windowRect.set_height(minSize.height);
+ windowRect = [self enforceMinWindowSize:windowRect];
// When we are given x/y coordinates of 0 on a created popup window, assume
// none were given by the window.open() command.
@@ -438,6 +434,13 @@ enum {
return self;
}
+- (void)awakeFromNib {
+ // Set different minimum sizes on tabbed windows vs non-tabbed, e.g. popups.
+ NSSize minSize = [self isTabbedWindow] ?
+ NSMakeSize(400, 272) : NSMakeSize(100, 122);
+ [[self window] setMinSize:minSize];
+}
+
- (void)dealloc {
browser_->CloseAllTabs();
[downloadShelfController_ exiting];
@@ -457,6 +460,18 @@ enum {
[super dealloc];
}
+- (gfx::Rect)enforceMinWindowSize:(gfx::Rect)bounds {
+ gfx::Rect checkedBounds = bounds;
+
+ NSSize minSize = [[self window] minSize];
+ if (bounds.width() < minSize.width)
+ checkedBounds.set_width(minSize.width);
+ if (bounds.height() < minSize.height)
+ checkedBounds.set_height(minSize.height);
+
+ return checkedBounds;
+}
+
- (BrowserWindow*)browserWindow {
return windowShim_.get();
}
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | chrome/browser/ui/cocoa/browser_window_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698