diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-07 19:26:00 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-07 19:26:00 +0000 |
commit | 4a0ab203f57e7d8dc0b3a75117d7901e45ec317e (patch) | |
tree | ecaea906ef58a61d2a02a313a7591f8fcfaac5f0 | |
parent | 26e86ef703e0621672442d74f5a984e75fedbaf8 (diff) | |
download | chromium_src-4a0ab203f57e7d8dc0b3a75117d7901e45ec317e.zip chromium_src-4a0ab203f57e7d8dc0b3a75117d7901e45ec317e.tar.gz chromium_src-4a0ab203f57e7d8dc0b3a75117d7901e45ec317e.tar.bz2 |
Enable the zoom button and stub out an implementation until we can get the real rect from WebCore.
Review URL: http://codereview.chromium.org/115096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15568 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index c2cf3e0..08250f1 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -82,13 +82,23 @@ willPositionSheet:(NSWindow *)sheet // Retain it per the comment in the header. window_.reset([[self window] retain]); + // Since we don't have a standard resize control, Cocoa won't enable the + // zoom (green) button on the titlebar for us. Grab it and enable it + // manually. Note that when launched from XCode, the doesn't work for the + // first window (and only the first window). There's some activation + // wonkiness there, since XCode stays active and the menus don't switch + // either. It always works when launched from the Finder. + NSButton* zoomButton = + [[self window] standardWindowButton:NSWindowZoomButton]; + [zoomButton setEnabled:YES]; + // Register ourselves for frame changed notifications from the // tabContentArea. [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(tabContentAreaFrameChanged:) - name:nil - object:[self tabContentArea]]; + addObserver:self + selector:@selector(tabContentAreaFrameChanged:) + name:nil + object:[self tabContentArea]]; // Get the most appropriate size for the window. The window shim will handle // flipping the coordinates for us so we can use it to save some code. @@ -161,8 +171,8 @@ willPositionSheet:(NSWindow *)sheet // Instead we use call it after a zero-length delay, which gets us back // to the main event loop. [self performSelector:@selector(autorelease) - withObject:nil - afterDelay:0]; + withObject:nil + afterDelay:0]; } // Called when the user wants to close a window or from the shutdown process. @@ -195,6 +205,23 @@ willPositionSheet:(NSWindow *)sheet BrowserList::SetLastActive(browser_.get()); } +// Called when the user clicks the zoom button (or selects it from the Window +// menu). Zoom to the appropriate size based on the content. +- (NSRect)windowWillUseStandardFrame:(NSWindow*)window + defaultFrame:(NSRect)frame { +#if 0 + // TODO(pinkerton): find a way to get the intrinsic size from WebCore over + // IPC. Patch coming in another CL to use this new API on TabContents. + // Need to enforce a minimum width as well (google.com has a very small + // intrinsic width). + TabContents* contents = browser_->tabstrip_model()->GetSelectedTabContents(); + int intrinsicWidth = contents->preferred_width(); + frame.size.width = intrinsicWidth; +#endif + + return frame; +} + // Update a toggle state for an NSMenuItem if modified. // Take care to insure |item| looks like a NSMenuItem. // Called by validateUserInterfaceItem:. |