diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-04 16:33:56 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-04 16:33:56 +0000 |
commit | f06ccec5826680ddeec130c1ab585fa6d1ab6ae0 (patch) | |
tree | b2e71a2e42b40f85996f78ede8aaa11ffbe84832 /chrome/browser/cocoa/browser_window_controller.h | |
parent | fea6521126499d1672d3a43c8375f83831f2de56 (diff) | |
download | chromium_src-f06ccec5826680ddeec130c1ab585fa6d1ab6ae0.zip chromium_src-f06ccec5826680ddeec130c1ab585fa6d1ab6ae0.tar.gz chromium_src-f06ccec5826680ddeec130c1ab585fa6d1ab6ae0.tar.bz2 |
Mac: restore window size/position when hiding bookmark bar or download shelf.
This applies in particular when the bookmark bar or download shelf causes the
window to grow at the top (due to there not being enough space at the bottom of
the screen). Note that resizing or moving reset the state (* for moving it's a
bit more subtle), so hiding afterwards will always shrink the window from the
bottom.
BUG=29192
TEST=(1) Navigate to a normal (non-NTP) page and hide bookmark bar; move window close to the bottom of the screen (keeping the window fully on-screen); Shift-Cmd-B to show the bookmark bar (which show grow maybe a bit downwards and then upwards); Shift-Cmd-B to hide it again; it should shrink from the top and from the bottom, restoring its original size/position. (2) Do the same but move the window away from the bottom of the screen after the first Shift-Cmd-B; now upon hiding it should only shrink at the bottom. (3) Check that if the window is far enough away from the bottom of the screen to begin with, then growing/shrinking only occurs at the bottom. (4) Do (1)-(3) for the download shelf (download something to show the shelf; then hide it by closing it).
Review URL: http://codereview.chromium.org/465024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33821 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/browser_window_controller.h')
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.h b/chrome/browser/cocoa/browser_window_controller.h index 02e04d9..68cbb82 100644 --- a/chrome/browser/cocoa/browser_window_controller.h +++ b/chrome/browser/cocoa/browser_window_controller.h @@ -77,6 +77,18 @@ class TabStripModelObserverBridge; BOOL initializing_; // YES while we are currently in initWithBrowser: BOOL ownsBrowser_; // Only ever NO when testing CGFloat verticalOffsetForStatusBubble_; + + // The total amount by which we've grown the window up or down (to display a + // bookmark bar and/or download shelf), respectively; reset to 0 when moved + // away from the bottom/top or resized (or zoomed). + CGFloat windowTopGrowth_; + CGFloat windowBottomGrowth_; + + // YES only if we're shrinking the window from an apparent zoomed state (which + // we'll only do if we grew it to the zoomed state); needed since we'll then + // restrict the amount of shrinking by the amounts specified above. Reset to + // NO on growth. + BOOL isShrinkingFromZoomed_; } // Load the browser window nib and do any Cocoa-specific initialization. @@ -171,12 +183,9 @@ class TabStripModelObserverBridge; // tab's sheet queue. - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; -// Delegate method called when window is resized. -- (void)windowDidResize:(NSNotification*)notification; - @end - +// Methods which are either only for testing, or only public for testing. @interface BrowserWindowController(TestingAPI) // Put the incognito badge on the browser and adjust the tab strip @@ -202,6 +211,10 @@ class TabStripModelObserverBridge; // Return a point suitable for the topLeft for a bookmark bubble. - (NSPoint)topLeftForBubble; +// Resets any saved state about window growth (due to showing the bookmark bar +// or the download shelf), so that future shrinking will occur from the bottom. +- (void)resetWindowGrowthState; + @end // BrowserWindowController(TestingAPI) #endif // CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |