diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 20:32:06 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 20:32:06 +0000 |
commit | df24335d48570c985a6c6a53303d399c53d4c367 (patch) | |
tree | c119db7f345250ecf53626c516d0d8c39ac3ed5f /chrome/browser/cocoa/bookmark_bar_controller.mm | |
parent | 14075a2c24068f8e8185dfc0d44878b486950905 (diff) | |
download | chromium_src-df24335d48570c985a6c6a53303d399c53d4c367.zip chromium_src-df24335d48570c985a6c6a53303d399c53d4c367.tar.gz chromium_src-df24335d48570c985a6c6a53303d399c53d4c367.tar.bz2 |
Send away bookmark bar folder when going fullscreen with menu.
BUG=http://crbug.com/49340
TEST=Open a bookmark folder.
With the VIEW MENU (not the keystroke), go fullscreen.
--> see "chrome" gone (unless mouse at top of screen); see bookmark menu gone.
With the VIEW MENU (not the keystroke), go normal-screen.
--> see no bookmark menu.
Review URL: http://codereview.chromium.org/3044012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.mm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index 97ccef0..fed3e5e 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -29,6 +29,7 @@ #import "chrome/browser/cocoa/bookmark_name_folder_controller.h" #import "chrome/browser/cocoa/browser_window_controller.h" #import "chrome/browser/cocoa/event_utils.h" +#import "chrome/browser/cocoa/fullscreen_controller.h" #import "chrome/browser/cocoa/import_settings_dialog.h" #import "chrome/browser/cocoa/menu_button.h" #import "chrome/browser/cocoa/themed_window.h" @@ -305,6 +306,18 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12; name:NSViewFrameDidChangeNotification object:[self view]]; + // Watch for things going to or from fullscreen. + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(willEnterOrLeaveFullscreen:) + name:kWillEnterFullscreenNotification + object:nil]; + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(willEnterOrLeaveFullscreen:) + name:kWillLeaveFullscreenNotification + object:nil]; + // Don't pass ourself along (as 'self') until our init is completely // done. Thus, this call is (almost) last. bridge_.reset(new BookmarkBarBridge(self, bookmarkModel_)); @@ -335,6 +348,23 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12; object:[[self view] window]]; } +// When going fullscreen we can run into trouble. Our view is removed +// from the non-fullscreen window before the non-fullscreen window +// loses key, so our parentDidResignKey: callback never gets called. +// In addition, a bookmark folder controller needs to be autoreleased +// (in case it's in the event chain when closed), but the release +// implicitly needs to happen while it's connected to the original +// (non-fullscreen) window to "unlock bar visibility". Such a +// contract isn't honored when going fullscreen with the menu option +// (not with the keyboard shortcut). We fake it as best we can here. +// We have a similar problem leaving fullscreen. +- (void)willEnterOrLeaveFullscreen:(NSNotification*)notification { + if (folderController_) { + [self childFolderWillClose:folderController_]; + [self closeFolderAndStopTrackingMenus]; + } +} + // NSNotificationCenter callback. - (void)parentWindowWillClose:(NSNotification*)notification { [self closeFolderAndStopTrackingMenus]; |