diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-08 21:47:59 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-08 21:47:59 +0000 |
commit | de29ea1e64e8cd1a7b662b3aca4aaca33ec0879e (patch) | |
tree | 87c1c602c85cb7e32b4d8cf14f5afd0db38663e5 | |
parent | c0dad6e6a80bbc1c4f74dd9d21e88f2d64512978 (diff) | |
download | chromium_src-de29ea1e64e8cd1a7b662b3aca4aaca33ec0879e.zip chromium_src-de29ea1e64e8cd1a7b662b3aca4aaca33ec0879e.tar.gz chromium_src-de29ea1e64e8cd1a7b662b3aca4aaca33ec0879e.tar.bz2 |
[Mac] Lock bar visibility during a bookmark button drag, forcing the fullscreen overlay to stay shown.
BUG=37433
TEST=Go fullscreen. Open a folder on the bookmark bar and drag a button around such that the folder closes. The overlay should not disappear.
Review URL: http://codereview.chromium.org/669166
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40944 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/cocoa/bookmark_button.h | 8 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_button.mm | 22 |
2 files changed, 29 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/bookmark_button.h b/chrome/browser/cocoa/bookmark_button.h index 304a07d..4401c10 100644 --- a/chrome/browser/cocoa/bookmark_button.h +++ b/chrome/browser/cocoa/bookmark_button.h @@ -93,6 +93,14 @@ class ThemeProvider; @interface BookmarkButton : DraggableButton { @private NSObject<BookmarkButtonDelegate>* delegate_; // weak like all delegates + + // Saved pointer to the BWC for the browser window that contains this button. + // Used to lock and release bar visibility during a drag. The pointer is + // saved because the bookmark button is no longer a part of a window at the + // end of a drag operation (or, in fact, can be dragged to a completely + // different window), so there is no way to retrieve the same BWC object after + // a drag. + BrowserWindowController* visibilityDelegate_; // weak } @property(assign, nonatomic) NSObject<BookmarkButtonDelegate>* delegate; diff --git a/chrome/browser/cocoa/bookmark_button.mm b/chrome/browser/cocoa/bookmark_button.mm index 5e87c09..f6274d7 100644 --- a/chrome/browser/cocoa/bookmark_button.mm +++ b/chrome/browser/cocoa/bookmark_button.mm @@ -7,6 +7,7 @@ #import "base/scoped_nsobject.h" #include "chrome/browser/bookmarks/bookmark_model.h" #import "chrome/browser/cocoa/bookmark_button_cell.h" +#import "chrome/browser/cocoa/browser_window_controller.h" // The opacity of the bookmark button drag image. static const CGFloat kDragImageOpacity = 0.7; @@ -60,6 +61,15 @@ static const CGFloat kDragImageOpacity = 0.7; // the stack. [self retain]; + // Lock bar visibility, forcing the overlay to stay visible if we are in + // fullscreen mode. + DCHECK(!visibilityDelegate_); + visibilityDelegate_ = + [BrowserWindowController browserWindowControllerForView:self]; + [visibilityDelegate_ lockBarVisibilityForOwner:self + withAnimation:NO + delay:NO]; + CGFloat yAt = [self bounds].size.height; NSSize dragOffset = NSMakeSize(0.0, 0.0); [self dragImage:[self dragImage] at:NSMakePoint(0, yAt) offset:dragOffset @@ -73,10 +83,20 @@ static const CGFloat kDragImageOpacity = 0.7; } } +// Overridden to release bar visibility. +- (void)endDrag { + DCHECK(visibilityDelegate_); + [visibilityDelegate_ releaseBarVisibilityForOwner:self + withAnimation:YES + delay:YES]; + visibilityDelegate_ = nil; + [super endDrag]; +} + - (void)draggedImage:(NSImage*)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation { - [super endDrag]; + [self endDrag]; } - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal { |