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..fcac43d9103d842aed6173dc74f232c91d7b2474 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 checked_bounds = bounds; |
Nico
2011/06/09 16:54:35
since this is an objc method, this should be calle
jennb
2011/06/09 17:54:51
Changed. Also fixed this style issue in unittest .
Nico
2011/06/09 17:56:19
In the mm file, the code is in a C++ class, so it
|
+ |
+ NSSize minSize = [[self window] minSize]; |
+ if (bounds.width() < minSize.width) |
+ checked_bounds.set_width(minSize.width); |
+ if (bounds.height() < minSize.height) |
+ checked_bounds.set_height(minSize.height); |
+ |
+ return checked_bounds; |
+} |
+ |
- (BrowserWindow*)browserWindow { |
return windowShim_.get(); |
} |